I am trying to use a powershell script that allows me to change the user account and password in which a particular service runs.
$account="domain\account" $password="password" $svc=gwmi win32_service -filter "name='MyService'" $svc.change($null,$null,$null,$null,$null,$false,$account,$password,$null,$null,$null)
I could verify that the account was changed, but when I tried to start the service from the Service.msc GUI, it failed with a login failure.
If I use to start the service from the script itself, I get the following error.
$svc.StartService() __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY : __PARAMETERS __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 0 PSComputerName : __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY : __PARAMETERS __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 15 PSComputerName :
According to microsoft, this is an input error: The return value is 15.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384901%28v=vs.85%29.aspx
I checked the password millions of times, and when I copy and paste the password using the GUI, it just works.
Maybe I missed something in my script. (SecurityPolicy on this computer is not limited)
Maverick
source share