Changes

Jump to: navigation, search

SYSTEM user Command Prompt

1,243 bytes added, 15:32, 20 May 2010
Created page with 'Sometimes while testing or debugging scripts and applications, it is useful to run programs as the SYSTEM user (also called NT AUTHORITY\SYSTEM or LocalService account). This is…'
Sometimes while testing or debugging scripts and applications, it is useful to run programs as the SYSTEM user (also called NT AUTHORITY\SYSTEM or LocalService account). This is the user context under which most services run. So, for example, if one is testing a workstation startup script, he would want to execute it as the SYSTEM user since that is the user account that runs system startup scripts.

==Usage==
Copy and paste the following lines into a text file and save it as '''systemcmd.bat'''. When you execute the script, you should be presented with a Command Prompt with a current working directory of '''c:\windows\system32'''.
<pre>
@ECHO OFF
:: systemcmd.bat
::
:: This bat file starts a command window (cmd.exe) under the SYSTEM (aka LocalSystem)
:: user context. Running this script requires Administrator rights on the local
:: workstation.

>NUL 2>NUL sc create systemcmd binpath= "cmd /C start" type= own type= interact
>NUL 2>NUL net start systemcmd
>NUL 2>NUL sc delete systemcmd
</pre>

To verify that it worked, run the command '''<tt>set user</tt>''' at the prompt. The output should look like:
<pre>
c:\windows\system32>set user
USERPROFILE=C:\Documents and Settings\LocalService

c:\windows\system32>
</pre>
Anonymous user

Navigation menu