locked
Schedule task not working RRS feed

  • Question

  • Hi,

    I have a ps1 script and I want to run it as a schedule task in windows 2008 R2 Enterprise server. Now I have created a cmd file and written the follwing code in the cmd file:

    c:\windows\system32\windowspowershell\v1.0\powershell.exe -command ". \"d:\scripts\myscript.cmd"".

    Now when I am schduling the cmd file with the following settings:

    run when whether user is logged in or not

    run with highest privileges

    The peculiar thing is that it is getting triggered but nothing happens after that and showing the error code 0x41325 in last run result.

    But when I am selecting "run when the user is logged on" it is running fine.

    Not sure where I am making mistake. Need help.

    Sunday, March 11, 2012 1:32 PM

Answers

  • Hello,


    Please note that if you select the option "Run whether user is logged on or not", tasks will not run interactively. For example, you created a task to launch notepad.exe and it wouldn’t run. Because notepad.exe needs user interaction and that lead to task failure. What is the end goal of your task? Is it interactive?


    Furthermore, check the permission. The user account you select for your program must have permission not only to run your program itself and but also to run all other program that related to your program. If the script involves a mapped drive, try use the full path name such as: \\servername\foldername.


    Thanks
    ZHANG


    Monday, March 12, 2012 6:32 AM

All replies

  • What is the expected result of this script. Is any result labeled with time & date?


    Sajeed AM

    Sunday, March 11, 2012 3:05 PM
  • Hello,


    Please note that if you select the option "Run whether user is logged on or not", tasks will not run interactively. For example, you created a task to launch notepad.exe and it wouldn’t run. Because notepad.exe needs user interaction and that lead to task failure. What is the end goal of your task? Is it interactive?


    Furthermore, check the permission. The user account you select for your program must have permission not only to run your program itself and but also to run all other program that related to your program. If the script involves a mapped drive, try use the full path name such as: \\servername\foldername.


    Thanks
    ZHANG


    Monday, March 12, 2012 6:32 AM