Running Scheduled Task using "Run whether user is logged on or not"
I created a scheduled task on a Windows Server 2008 R2 box that kicks off Powershell which in turn runs a robocopy command to mirror a directory on the server itself with a mapped drive to another machine on the same domain. When I manually start the scheduled task using the "Run only when user is logged on" option I can see the task run interactively and it mirrors the directories as expected. When I change the ST to use the "Run whether user is logged on or not" the script does not get executed. I understand that it will not be interactive if I run it in this manner but I do not understand why it does not run the script that contains the robocopy command. The ST reports that it completed successfully. I am using my domain account to launch the ST; I am an admin on the local server, a domain admin on the domain and I have full read/write/execute to the mapped drive I am copying to. I am also in the Local Security Policy for "Log on as a service" and "Log on as a batch job." Any ideas?
July 6th, 2010 8:38pm

Hi Akacojack, Some programs require elevated privileges to run correctly. If a task is running a program that requires elevated privileges, ensure that the task runs with the highest privileges. You can set a task to run with the highest privileges by changing the task's security options on the General tab of the Task Properties dialog box. Please also carefully check the settings of the task scheduled. Make sure the trigger is enabled for the scheduled time to run the task. The conditions and settings tab is properly configured. If the task still won’t run correctly, please check the history of the task for errors. For the detailed steps, please refer to the link below. View Task Properties and History http://technet.microsoft.com/en-us/library/cc722006.aspx Regards, Karen JiPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2010 10:50am

Thanks for your response Karen Ji. The scheduled task was not set to "Run with the highest privileges" so I updated the ST to make that change. After making the change, I allowed the ST to kickoff the script again at a scheduled time while I was not logged on to the server and it reported that it ran successfully but the PS script with the robocopy command did not mirror the directories as expected. I then updated the ST to "Run only when user is logged on" leaving the "Run with highest privileges" in place and it failed saying it could not find the mapped drive even though it is clearly available. I once more updated the ST, disabling the "Run with highest rivileges" and the ST kicked off the PS script and the directories on the local server and the mapped drive were mirrored as expected. My main goals here are to 1) Get the PS script to work when not logged on 2) Learn what I am doing wrong to avoid this issue in the future. My first thought is that it is some sort of permission issue but then I don't understand why it would run at all. Again, the ST always shows that it completed successfully, it just does not kickoff the PS script like it does when it is set using "Run only when user is logged on."
July 7th, 2010 8:30pm

Hi Akacojack, I would think that it is the problem of the script that you are trying to run. Did you specify the script to map a drive to another computer or just specify the drive letter of the mapped drive, if so, the computer wouldn't know which drive to copy to. You may also try specify the UNC path of another computer instead of mapping a drive which will prevent such problems. Additionally, please also check the history of the task for errors. Regards, Karen JiPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 10:00am

Thanks for the help Karen Ji. I did update the robocopy script to use the UNC path of the file rather than expecting it to see the mapped drive and was able to run the script while not being logged on as the user. Although I am not exactly sure as to the why - it did work and I appreciate your help.
July 19th, 2010 5:01pm

Check this out: http://modmaven.wordpress.com/2009/05/27/how-to-make-windows-7-map-your-network-drives-properly/ The registry setting answered all of my issues concerning 'missing' mapped drives when running with highest priveleges. It has been a LONG search for what is a very simple fix (from my side of things anyway). Hope you're not still looking around for the fix.
Free Windows Admin Tool Kit Click here and download it now
November 9th, 2010 12:03am

I created a scheduled task on a Windows Server 2008 R2 box that kicks off Powershell which in turn runs a robocopy command to mirror a directory on the server itself with a mapped drive to another machine on the same domain. When I manually start the scheduled task using the "Run only when user is logged on" option I can see the task run interactively and it mirrors the directories as expected. When I change the ST to use the "Run whether user is logged on or not" the script does not get executed. I understand that it will not be interactive if I run it in this manner but I do not understand why it does not run the script that contains the robocopy command. The ST reports that it completed successfully. I am using my domain account to launch the ST; I am an admin on the local server, a domain admin on the domain and I have full read/write/execute to the mapped drive I am copying to. I am also in the Local Security Policy for "Log on as a service" and "Log on as a batch job." Any ideas? You need to uncheck "Do not store password" in order to reference UNC paths in your powershell scripts. This way, it can authenticate against remote paths when it runs the script.
April 27th, 2011 3:30pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics