Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How to change user credentials of windows service from command line?

share|improve this question

2 Answers 2

You're looking for:

sc config <servicename> obj= <accountname> password= <password>

The "sc" command will work on remote machines, too. Start it with no arguments to get more info. (It's a bit odd in requring spaces after many of the arguments. I can't say I've seen a similiar command-line program.)

share|improve this answer
3  
+1 for mentioning the bizarro requirement of a space after many arguments. Been bitten by that plenty of times. –  ThatGraemeGuy Jun 29 '09 at 17:56
1  
I tried the answer but I was getting "The parameter is incorrect." until I added type= own. This happened on Windows server 2008R2 Core edition. Also - add the machine name/domain before the username. –  Stoinov Jan 17 '12 at 9:44

you can use passgen.exe too, it is very handy can generate complex password for you and set it.

C:\>passgen.exe /?


===============================================================================
passgen.exe v. 1.1, Copyright (c) 2005, Jesper M. Johansson.
This program is used to generate and/or set a password on an arbitrary account.
For complete details on how to use passgen.exe see the doc file that is
distributed with the tool.

This program is primarily distributed with the
"Protecting Your Windows Network" book. For feedback on the tool
e-mail info@protectyourwindowsnetwork.com.
passgen.exe may be freely re-distributed within the organization that paid for the book so long as it remains unmodified and is accompanied by the readme file.

===============================================================================

There are three valid modes and associated options you may use:

passgen.exe -g <identifier> <pass phrase> [-l <desired length>]
        [-e <desired character set>] [-c <account name> [<old password>]]
        [-m <machine/domain>] [-d <service name>] [-h]

passgen.exe -r [-l <desired length>] [-e <desired character set>]
        [-c <account name> [<old password>]] [-m <machine/domain>]
        [-d <service name>] [-h]

passgen.exe -s [-c <account name> [<old password>] [-m <machine/domain>]
        [-d <service name>]]

For details on the usage of these options see the readme file that comes with
the tool. If you received the tool without a readme file please e-mail
info@protectyourwindowsnetwork.com

===============================================================================
share|improve this answer
    
Looks like the copyright says if you havent purchased the book, you shouldnt use the tool... –  RobW Jan 19 '12 at 16:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.