Set Windows Service Log On (Log On As) back to Default Local System Account

I have several Servers where the Service for an application was mis-configured to Log On (Log On As) a Domain\Account.

I need to set these Services on each Server back the the Default Setting Log On (Log On As) Local System Account.

I have found the example of finding the order for the WMI change i.e.-

PS C:\> $svc = get-wmiobject win32_service -filter "name='Service_Name'"
PS C:\> $svc.GetMethodParameters("change")
But I cannot find an example to set the StartName back to the Default Setting.
Would this all be a $null ??
Example per Jeff Hicks -
PS C:\> $svc | Invoke-WmiMethod -Name Change -ArgumentList @($null,$null,$null,$null,$null,$null,$null,$null,$null,$null,$null)
Or would the correct way to be using LocalSystem?
PS C:\> $svc | Invoke-WmiMethod -Name Change -ArgumentList @($null,$null,$null,$null,$null,$null,$null,$null,$null,"LocalSystem",$null)
I know this can easily be done with the CIM as this example from Jeff Hicks
PS C:\> Get-CimInstance win32_service -filter "name='yammmsvc'" | Invoke-CimMethod -Name Change -Arguments @{StartName=".\Jeff";StartPassword="P@ssw0rd"}
But I do not know what to use for StartName...

I believe I found it. I would like verification if this is not the correct way…


I was running this with an Admin Logon Credential and was getting a return code of 2, however once I ran the PowerShell session As Admin this worked.

PS C:> Get-CimInstance win32_service -filter “name=‘some_service_name’” | Invoke-CimMethod -Name Change -Arguments @{StartName=“LocalSystem”}






Yes, this is the correct method. If you wanted to add a password, add StartPassword to the hash table. StartPassword accepts a string value, just be careful when configuring.