Windows 2008 startup script will not run?

I am trying to get a very simple batch script to run when my Windows 2008 Server (R2) system starts up. I have added the script to the "Startup Scripts" in the local group policy by running gpedit.msc, and I see the script listed under Windows Settings/Scripts (Startup/Shutdown)/Startup when I run rsop.msc, but the script is not being executed. The "Last Executed" column in rsop is empty even after a reboot, and a file that should be created by the script is never created.

At the moment, the entire contents of the script are:

rem Check if this script is running.
date /t > c:\temp\flag

The target directory (c:\temp) exists. The script is called c:\scripts\startup.bat, and works fine if I run it by hand.


You should grab a copy of psexec and run psexec -s path\to\script.bat. That will run it as System. That's a more accurate manual test than running it as the logged in user, since startup scripts run as SYSTEM.


check the registry key hklm\software\microsoft\windows\currentversion\run

You can add your script there if it is not already

http://www.akadia.com/services/windows_registry.html

otherwise check permissions on the folder to make sure the system account has write access