In my environment, I have over 100+ servers and every so many days, the account that runs SQL services are changed and it is a bitch to change it via point and click on 100+ servers. The script first look at the local machine and return services that has the [log on as] that matches PHX. It will then go into a foreach loop and change the password for only those services. The win32_service wmi has a [-computer] option, in which, you can use to access remote server.
$services = Get-WmiObject win32_service | where {$_.StartName -match '^PHX\*'}
$pwd = "pwd_here"
if ($matches[0] -ne $null)
{
foreach ($service.Name in $services)
{
write-host $service.Name
$service.Change($null,$null,$null,$null,$null,$null,$null,$pwd,$null,$null,$null)
}
}
if there are no matches, the script will bomb.