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

前端 未结 4 539
执笔经年
执笔经年 2020-12-08 10:00

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

4条回答
  •  时光说笑
    2020-12-08 10:30

    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
    

提交回复
热议问题