I have a task setup:
- Run whether logged in or not
- Run with highest privs
- When running the task use the following account (my admin account)
Program / Script: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -ExecutionPolicy Bypass C:\Temp\test.ps1
test.ps1
contains:
Write-Host "Hello"
If I run this script as my normal user without run as highest privs, powershell launches and it works as expected.
When using the above settings though, it shows as running, then shows as completed with a result of 0x0
but powershell doesn't launch.
Any ideas what I'm doing wrong?
Note: I've tried setting the Start In to C:\Temp, I've tried various other arguments like noprofile
nologo
etc.
Answer
PowerShell is running in a different user-context since you run this task as a different user than you're currently logged in. That's why you don't see any PowerShell window.
To make sure that your script really runs, try creating a txt file in your script. if it gets created, your script runs.
No comments:
Post a Comment