Using sc command we can query, start , stop windows services.
For ex:
sc query "windows service name"
The sc config command changes the configuration of the service, but I don't know how to use it.
Could someone tell me how we can set the username and password for any windows service?
To configure this, Navigate to Admin >> Settings >> General Settinngs. In the UI that opens, select Password Reset from the options on the left hand side. Click the checkbox Wait for a specified time period (in seconds) between stopping and starting the services.
This works:
sc.exe config "[servicename]" obj= "[.\username]" password= "[password]"
Where each of the [bracketed] items are replaced with the true arguments. (Keep the quotes, but don't keep the brackets.)
Just keep in mind that:
obj= "foo"
is correct; obj="foo"
is not.In PowerShell, the "sc" command is an alias for the Set-Content cmdlet. You can workaround this using the following syntax:
sc.exe config Service obj= user password= pass
Specyfying the .exe extension, PowerShell bypasses the alias lookup.
HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With