0

I've created an scheduled task to call a webpage using PowerShell, but I don't know why it is not going to be ended after execution, and the status remains "Running".

The action is "Start a program", with this parameter:

powershell -ExecutionPolicy unrestricted  -Command "(New-Object Net.WebClient).DownloadString(\"http://x.x.x.x/SomeUrl/\");"

Note that this task is configured to run by SYSTEM user, for being hidden while running.

0

To troubleshoot commands that are stuck under the system account I use PsExec

I would start an interactive system session like so:

PsExec.exe -s -i powershell.exe

And then try to execute the command.

Remember that when you run under the system environment in a scheduled task that you best use full paths to executables. So I would also replace powershell with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Also make sure you set the "Start in" setting of your scheduled task when you trigger that command without defining a location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.