Forum Discussion
Animesh Joshi
Apr 11, 2022Brass Contributor
Service control manager cached credentials
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 https://docs.microsoft....
Apr 11, 2022
You can use set-service -credential with PowerShell 7 (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.2)
Example 8: Change credential of a service
This example changes the credentials that are used to manage a service.
$credential = Get-Credential
Set-Service -Name Schedule -Credential $credential
Get-Credential prompts for a username and password, and stores the credentials in the $credential variable. Set-Service uses the Name parameter to specify the Schedule service. The Credential parameter uses the $credential variable and updates the Schedule service.
You could use https://pscustomobject.github.io/powershell/howto/PowerShell-Create-Credential-Object/ to use it in a script (SecureString)
Example 8: Change credential of a service
This example changes the credentials that are used to manage a service.
$credential = Get-Credential
Set-Service -Name Schedule -Credential $credential
Get-Credential prompts for a username and password, and stores the credentials in the $credential variable. Set-Service uses the Name parameter to specify the Schedule service. The Credential parameter uses the $credential variable and updates the Schedule service.
You could use https://pscustomobject.github.io/powershell/howto/PowerShell-Create-Credential-Object/ to use it in a script (SecureString)
Animesh Joshi
Apr 11, 2022Brass Contributor
Thank you, Harm_Veenstra. We have Powershell 4.0. Its a legacy, locked-down kiosk type environment. Also, there's no option for getting users to input he new password so we'll be utilising SCCM task sequence to run a script and supply secure credentials.
I believe SC.exe and/or WMI should be able to update the password.
I believe SC.exe and/or WMI should be able to update the password.