How to change user credentials of windows service from command line?
A:
At least with current versions of Windows, the only way to change the credentials of a Windows service is through the Services control panel or through a program written to use the Windows API.
It may be possible to use Windows PowerShell to do this through a script: the good folks on http://serverfault.com would be delighted to help, I'm sure.
Jeremy McGee
2009-06-08 19:08:50
A:
I simply called WMI from powershell to do this.
$Svc = Get-WmiObject win32_service -filter "name='ServiceName'"
$Svc.Change($Null, $Null, $Null, $Null, $Null, $Null, "User", "Password")
Don't forget to restart the service afterwards:
Stop-Service -Name 'ServiceName'
Start-Service -Name 'ServiceName'
For more fun with WMI and services, see Win32_Service Class
Jesse Weigert
2009-06-08 19:35:07
+1
A:
sc.exe config "Service Name" obj= "DOMAIN\User" password= "password"
See Shortcut Setting Log-On Credentials for Windows Services » jonathanmalek.com.
brianary
2009-08-24 21:06:53