Tuesday, June 4, 2013

I was having trouble on Windows 2008 R2 running a batch script from a (local) shared drive as an Administrator (by right clicking and choosing run as Administrator). The command prompt window would just flash and never run successfully run the script, so doing the following made the shared drive "visible" to the Administrator profile, and would then allow successful running of the script.

Here is what I did, using ideas gleaned from the websites listed below... and copying some of their comments... Thanks guys...


--I wanted to create a service that would allow me to spawn a command prompt under the context of the local system

sc create syscommand binpath= "cmd /K start" type= own type= interact


--Then I started the service

sc start syscommand


--Voila, apart from a few minor errors, the command prompt popped up (sigh of relief)

--Run Net to map a drive for the system context, then every user account, including the Administrator, will have access to that shared drive

NET USE Z: \\MyLocalMachine\MyLocalShare


--removed the service account

sc delete syscommand



Ideas taken from:


http://wmug.co.uk/wmug/b/scambler/archive/2011/02/07/interactive-command-prompt-under-the-system-context-and-server-2008.aspx

and

http://www.sevenforums.com/network-sharing/34110-run-admin-network-drive.html

No comments:

Post a Comment