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

**URL:** <https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407>\
**Category:** PowerShell Help\
**Created:** [April 16, 2019, 1:45pm UTC](https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407 "2019-04-16T13:45:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim-bolton](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tim-bolton](https://forums.powershell.org/u/tim-bolton)\
**Post date:** [April 16, 2019, 1:45pm UTC](https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407/1 "2019-04-16T13:45:51Z")

</div>

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 - [https://4sysops.com/archives/managing-services-the-powershell-way-part-8-service-accounts/](https://4sysops.com/archives/managing-services-the-powershell-way-part-8-service-accounts/)

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...

&nbsp;

---

<div class="post-metadata">

**Author:** ![tim-bolton](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tim-bolton](https://forums.powershell.org/u/tim-bolton)\
**Post date:** [April 16, 2019, 2:26pm UTC](https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407/2 "2019-04-16T14:26:59Z")

</div>

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

&nbsp;

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:&gt; Get-CimInstance win32\_service -filter “name=‘some\_service\_name’” | Invoke-CimMethod -Name Change -Arguments @{StartName=“LocalSystem”}

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![pwshliquori](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/pwshliquori/32/222_2.png) [@pwshliquori](https://forums.powershell.org/u/pwshliquori)\
**Post date:** [April 16, 2019, 5:36pm UTC](https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407/3 "2019-04-16T17:36:39Z")

</div>

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.

pwshliquori

---

<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:32pm UTC](https://forums.powershell.org/t/set-windows-service-log-on-log-on-as-back-to-default-local-system-account/12407/4 "2024-05-16T20:32:59Z")

</div>


