// This is the script to give summary on the main page.
Think IPM

Thursday, April 14, 2011

Troubleshooting Tip: Run your Script in the SYSTEM context

imageAaron Silber sent over a quick Microsoft troubleshooting tip for Windows 2003 servers:

Here is a cool little tip I picked up from Microsoft tech support while working at a client recently. I was having an issue with a machine startup script working properly and had put in all sorts of pauses and various piping to log files, but really needed to be able to just “see” what was going on. Additionally, every time I would go to make a change, I would have to wait for the machine to reboot, run the shutdown script and go through the whole boot process, a real pain indeed. One of the issues I was having was that the scripts were working fine when I test ran them after I logged in.

The first thing I thought of was to set the policy to run the machine scripts visible, this helps out a little, but is still not great for troubleshooting.  So here is the tip; one thing to think about is that when the scripts are running they are in the SYSTEM context which is not a real user that you can do a runas or log in with, sooooo,
here’s what you do; Run the following command:


Make sure to set the time to about 1 minute ahead of the current time, what this will do is launch a CMD prompt as the SYSTEM user. From this command prompt, anything that you do will run as the system account, so you can test out drive mappings, scripts, permissions, etc. (Keep the pauses of course)

Unfortunately the ability to create interactive tasks in Windows 7 /2008 is done via the Scheduled Tasks applet (GUI), once I have a chance, I’ll see if I can find a CLI equivalent but I doubt it will be as simple or elegant.

See ya!

If you have a 2008/7 solution, Let us know if the comments.  Thanks for sharing Aaron!

blog comments powered by Disqus Blog Widget by LinkWithin