by mukkollu at 2013-03-21 15:11:13
Hi,by ps_gregg at 2013-03-21 21:22:18
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
Hi SM,by mukkollu at 2013-03-22 08:53:45
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
So silly, I missed the domain part. Thanks Gregg.