Ever wanted to automatically change the Password a service uses to log on to its account? WMI has a solution. Have a look:
$newpassword = “secret@Passw0rd”
$service = Get-WmiObject win32_Service –Filter “Name=’Spooler'”
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.