Windows Task Scheduler silently fails

Hi folks

Today I’ve discovered an issue which I would like to share.

We had a Task Scheduler task which runs cmd, and that cmd runs robocopy to backup some files to the network drive.

I’ve been asked to investigate why it is not working and not showing any errors.

According to the TaskScheduler event log: task completes within with event type 201

Task Scheduler successfully completed task "\Mytask" , instance "{b35cde71-a3d3-46fc-9ee7-be66e54a5636}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 0.

After some head scatches I found the root cause

Firstly, it started to work when I enabled Run only when user is logged on

run-only-when-user-is-logged-on

Previously it was Run whether user is logged on or not

The drawback of the second mode is that the running process windows are hidden so we cannot see what is going on.

And after some googling I found that in this mode none of mapped drives will work

http://www.networksteve.com/forum/topic.php/Running_Scheduled_Task_using_%22Run_whether_user_is_logged_on_or_n/?TopicId=10304&Posts=0

And here is the solution for that

http://modmaven.wordpress.com/2009/05/27/how-to-make-windows-7-map-your-network-drives-properly/

Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLinkedConnection -Value 1 -Type DWord
Advertisements

About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s