[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Script to configure an existing service to run with a different account

Does anyone have a script that will configure an existing service running on a PC to use a different user account other than the local system account? Here is an example to put it into context:

SERVER1 (Windows Server 2003) currently has a Service running called 'Service1' which is running as the "log on as" user account of local system. This Service needs to be reconfigured so that the "log on as" user account is 'srvrun@domain.com' with the password of 'password'.
  • 2
1 Solution
dont think thats possible!
But u can start the service with specified credentials!

runas /user yourdomain\youraccount net start messenger
note the differences between starting a service and running a service!
You can do that with sc.exe (even remotely; for local execution, just drop the "\\server1").
sc \\server1 config Service1 obj= srvrun@domain.com password= password
Things worth noting:
* Note spaces after the equal signs in "obj=" and "password="!
* I'm not completely sure whether sc understands the UPN syntax and can't test it at the moment. If it doesn't work, use YOURNETBIOSDOMAINNAME\srvrun instead of srvrun@domain.com
* Don't use characters in the password that have special meaning in the command line: | < > % ^ & " ( )

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now