Run CMD as LOCAL SYSTEM User

Zenith Infotech‘s SAAZ platform allow you to set up jobs to run on client machine, e.g. for installing software. The jobs run as user LOCAL SYSTEM. Deploying a SAAZ job can take 15-30 minutes, which is too long to wait between test runs. So how does one open a command prompt as user LOCAL SYSTEM for testing? Adi Otlean provides the answer near the end of this post:

  1. Open a command prompt and type
    sc create CmdSvc binpath= "cmd /K start" type= own type= interact
    sc start CmdSvc
    Attempting to start the service will fail with error 1053 because CMD doesn’t have any service-related code. However it will also open a new CMD window running as LOCAL SYSTEM.
  2. Do your testing in the new CMD window.
  3. When you’re done, you might want to get rid of the service:
    sc delete CmdSvc

Thanks Adi

Update December 11, 2014

Even easier, use PsExec from Sysinternals:

"C:\Program Files (x86)\Sysinternals\psexec.exe" -s -accepteula cmd

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.