How to change user credentials of windows service from command line?
sc.exe config "Service Name" obj= "DOMAIN\User" password= "password" type= own
See Shortcut Setting Log-On Credentials for Windows Services » jonathanmalek.com.
@MattT points out that on Windows Server 2008R2 you have to add type= own
, but prior to that version it isn't necessary.
In PowerShell 3+, you can avoid escaping the arguments with the stop-parsing symbol: --%
sc.exe --% config "Service Name" obj= "DOMAIN\User" password= "password" type= own