Ever wanted to automatically change the Password a service uses to log on to its account? WMI has a solution. Have a look:
$localaccount = “.\sample-de-admin-local”
$newpassword = “secret@Passw0rd”
$service = Get-WmiObject win32_Service –Filter “Name=’Spooler'”
$service.Change($null,$null,$null,$null,$null,$null, `
$localaccount, $newpassword)
$newpassword = “secret@Passw0rd”
$service = Get-WmiObject win32_Service –Filter “Name=’Spooler'”
$service.Change($null,$null,$null,$null,$null,$null, `
$localaccount, $newpassword)
These lines assign a new User Account and Password for the Spooler service. Note that your account will need special privileges to be able to do that. If you get an “access denied” error, open services.msc and try to change the account manually using the GUI. You will get a message if your account lacks the necessary privileges and the privileges are added.