Update password cached by Service Control Manager

aj-47 66 Reputation points
2022-04-11T05:56:57.817+00:00

Our AD joined, ESU licensed win7 pro devices have a 4-5 application services that log on using and AD account as opposed to the local system account.
Code snippet listed here changing-the-password-on-a-serviceampaposs-user-account

shows how to update the password in Service Control Manager(SCM) through C++. I'm using ADSI in Powershell to update password in AD. However, can Powershell be utilised to update password cached in SCM too?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,901 Reputation points
    2022-04-11T19:03:41.157+00:00

    If you're using PowerShell 7 the Set-Service cmdlet has a -Credential parameter that'll do that.

    If you're using PowerShell 5 you have to use either WMI or the utility SC.EXE to do this.

    This has examples of both and comments on some the problems with using WMI to accomplish this: powershell-script-to-change-service-account

    There's also this, if you want to try it: changing-service-credentials-using-powershell


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.