문제

I have a problem regarding how to make a scheduled task to run whether the user is logged on or not. It must be done in powershell. What i have done is:

$WINDIR/system32/schtasks.exe /create /tn TaskName /sc daily /st 15:05:00 /tr "C:\cygwin\opt\IBM\tpchc\bin\tools\TheFileToRun.bat"

But can i provide an extra argument making this task run no matter if the user is logged on or off?

If it cant be done in Powershell is it then possible to do it in another script language?

thx :)

도움이 되었습니까?

해결책

You'll need to specify a user (like /RU system), but it should be the default whether to run logged in or not. You can look at this link for a list of all schtasks.exe parameters.

다른 팁

if you add

/RU <username> /RP <password>

to the call to schtasks.exe you will get "Run whether user is logged on or not" selected.

You can also use the /NP instead, which will also give you "Run whether user is logged on or not", but also "Do not store password..." which will limit the accessible resources.

I got a Working solution, just add this:

/RU "NT AUTHORITY\SYSTEM" /RP *

Will run as System and ignore password, Tested on XP

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top