MS Windows – Scheduler – Error – “An account failed to log on” – NULL SID ( Day 2)


In a recent post, we spoke of correcting a scheduled process that was failing on the robocopy step.

We fixed it by setting the Scheduled task to run with the “Run with highest privileges” option turned on.



Original Code

Here is the original code

robocopy \\DBPROD\f$\SQLBackups\csLogins F:\Microsoft\SQLServer\Restore *.bak /ZB /ETA


ERROR: You do not have the Backup and Restore Files user rights.
***** You need these to perform Backup copies (/B or /ZB).

Better Code

Here is the revised code

robocopy \\DBPROD\f$\SQLBackups\csLogins F:\Microsoft\SQLServer\Restore *.bak /Z

And, here is another version that we tweaked a bit

set "_app=robocopy"

set "_srcFolder=\\DBPROD\f$\SQLBackups\csTrafficSchool"
set "_srcFile=*.bak"
set "_destFolder=F:\Microsoft\SQLServer\SQLRestore"

@rem Initiate copy
%_app% %_srcFolder% %_destFolder% %_srcFile% ^
		/r:1 /w:1  ^
		/NP  	   ^


We originally chose the /zb option as it offers the “restartable” option.

Unfortunately, /zb connotes restartable and backup.

In this case, it was an overkill.

Choosing /z is sufficient.

To squeeze out some performance:

  • We added /r and /w to restrict number of retries and duration  between retries
  • Also, added /LOG to log to a file rather than to the console



Process Monitor

Though, unfortunately not quite useful, here is what we captured via SysInternal’s Process Monitor.







Process Operation Path Result
 robocopy.exe CreateFileMapping C:\Windows\SysWow64\tzres.dll File Locked with only readers



Process Operation Path Result
 robocopy.exe CreateFileMapping C:\Windows\SysWow64\tzres.dll File Locked with only readers
 robocopy.exe  QueryDirectory  <remote-server>\<path>  NO MORE FILES
 robocopy.exe  QueryOpen  F:\Microsoft\SQLServer\Restore\*.bak  NO SUCH FILE
 robocopy.exe  QueryOpen   F:\Microsoft\SQLServer\Restore\csLogins.bak  Name Not Found




When successful, robocopy follows the “Create File Mapping” operation with querying the remote server and getting the files that match our file signature.  And, upon doing that the destination is queried to determine whether same files exist.



I think replacing the /zb option with /z is a more granular and direct approach.

Here are the quick reasons:

  1. The earlier option runs the entire scheduled task with this (Run with highest privileges) option on.
    • This means that we are not setting at an intermediate step level, but for the entire task

Leave a Reply

Please log in using one of these methods to post your comment: 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