# Unable to update service password remotely

**URL:** <https://forums.powershell.org/t/unable-to-update-service-password-remotely/761>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/unable-to-update-service-password-remotely/761 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/unable-to-update-service-password-remotely/761/1 "2011-12-31T18:30:00Z")

</div>

by mukkollu at 2013-03-21 15:11:13

> Hi,  
> I wrote the below script to change password for "test" service on windows 2003 64-bit server "server1". I am running this script on windows 7 64-bit machine. It always throws the below error status.  
>   
> [code2=powershell]$newPass = Read-Host "Enter Password"  
> $sn = "test"  
> $fl = 'Name=' + "'" + $sn + "'" + ''  
> $service = Get-WMIObject -ComputerName "server1" -class Win32\_Service -Filter $fl  
> $service.Change($null,$null,$null,$null,$null,$null,$Acct,$newPass,$null,$null,$null)  
> $service.StopService()  
> $service.StartService()[/code2]  
>   
>   
> \_\_GENUS : 2  
> \_\_CLASS : \_\_PARAMETERS  
> \_\_SUPERCLASS :   
> \_\_DYNASTY : \_\_PARAMETERS  
> \_\_RELPATH :   
> \_\_PROPERTY\_COUNT : 1  
> \_\_DERIVATION : {}  
> \_\_SERVER :   
> \_\_NAMESPACE :   
> \_\_PATH :   
> ReturnValue : 22  
>   
> I am able to remotely start and stop the same service.  
>   
> Thanks,  
> SM

by ps\_gregg at 2013-03-21 21:22:18

> Hi SM,   
>   
> A Return Value 22 equals "Status Invalid Service Account". So the first thing I would check your is the $Acct variable. Is it populated with a valid service account? Does the variable contain the domain like "DOMAIN\ServiceAcct".   
>   
> -Gregg

by mukkollu at 2013-03-22 08:53:45

> So silly, I missed the domain part. Thanks Gregg.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:58pm UTC](https://forums.powershell.org/t/unable-to-update-service-password-remotely/761/2 "2024-05-16T20:58:00Z")

</div>


