Powershell Service Account Password Change Logon Failure


i am trying to use a powershell script that allows me to change the user account and password a specific service runs under.

I could check that the account was changed but when i tried to run the service from the Service.msc GUI it fails with a logon failure.

If I use to start the service from the script itself i get the following error.

According to microsoft it is a logon error : Return Value 15.


I have verified the password a millions time and when I copy and paste the password using the GUI it just works.

May be i am missing something in my script. (SecurityPolicy is unrestricted on this machine)


You need to set the SeServiceLogonRight privilege on the user before setting the service account.

An example of the Set-Privileges function which uses LSA:


Powershell Service Account Password Change Logon Failure by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply