Update password cached by Service Control Manager

aj-47 66 Reputation points

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 Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,435 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,431 Reputation points

    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