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


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

And here is the solution for that

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

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: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s