How do I 'run as' 'Network Service'?
Solution 1:
Use PsExec.exe from SysInternals, running from an elevated command prompt.
e.g. this will open a new command prompt running as NETWORK SERVICE:
psexec -i -u "nt authority\network service" cmd.exe
this will run it as LOCAL SYSTEM:
psexec -i -s cmd.exe
You can verify these by running whoami
from the cmd prompt.
See also:
http://forum.sysinternals.com/how-to-start-cmdexe-as-network-service_topic15797.html
Interactive command prompt as NETWORK SERVICE
Solution 2:
In Task Scheduler, create a task to run the application under the NETWORK SERVICE user. You can then run the task from the command line using
schtasks /run /TN "taskname"
Where taskname is the name of your task.