data-ad-format="horizontal">

Run A Scheduled Task As SYSTEM

Scheduled Task IconSometimes I come across this stuff accidentally. Other cases, like this one, it was something I needed and everything I looked at – told me it was possible, then not possible. What was the answer? and was it really possible? What I wanted to do was simply map a drive to a network share as the local SYSTEM account of a Windows computer. That, took me down this twisty road that leads me to a definitive answer: Yes, it can be done. Let me show you.

So, here’s what happens – you try to setup a task – in my case a simple batch file called map.bat that will map a drive:

net use S: \\192.168.1.5\public /USER:192.168.1.5@username password

This will run on Windows XP and I want that task to run as the SYSTEM account on the computer. So, I got to Scheduled Tasks in XP and create the task to run. Also note, when setting the account for your newly created account, you type “SYSTEM” and not what you see below “NT AUTHORITYSYSTEM”. When you put SYSTEM in, the rest is automatically filled in.

The simple task

When you try and execute that task you get nothing. Nada.

Then you go check out the log – typically found in C:WindowsSchedLgU.Txt and you find this kind of error:

“map.job” (map.bat) 11/22/2011 6:18:20 PM ** ERROR **


The attempt to log on to the account associated with the task failed, therefore, the task did not run.
The specific error is:
0x80041314: The task has been configured with an unsupported combination of account settings and run time options.

Verify that the task’s Run-as name and password are valid and try again.

What’s Going on? Well,  as Microsoft says “This issue occurs because you cannot configure a task to use the System account using the Scheduled Tasks Wizard”. So, whatever you think is possible, using the Scheduled Tasks wizard will not get you a scheduled task that runs with the SYSTEM account.

The AT Command 
Remember AT? You really thought all the stuff you learned about Windows NT was a waste eh? The lowly AT command relegated to a small included utility in Windows XP is great because it will do exactly what we need. Here’s how we do this.

1. If you haven’t done so  – make the above batch file – I put it here: c:map.bat

2. Open a command prompt and type:

at 12:00 /every:M,T,W,Th,F,S,Su c:map.bat

In the above example I’m running the task a 12:00 noon every day of the week and c:map.bat is the batch file I’m running. More on the AT command can be found here.

3. Verify your task by looking at the Scheduled Tasks:

Also, if you go to the properties of the task, you’ll see that everything is greyed out and the task is named At1:

All goes well in the above scenario, you’ll see a “disconnected” drive in Explorer like the S: drive below:

One warning, however, all of the above is only for Windows XP. While AT is also on Windows Vista and Windows 7, your mileage may vary as far being able to get this work. Has anyone tried this on Vista or 7?