Change the Service Account of a Sharepoint 2010 Service

This seems (and indeed it is) a trivial task. Just go to Sharepoint Central Administration >> Service Accounts
and choose the managed account for the available services in your farm. That’s fine. However if you have changed
the identity of a service to a domain account, then the list does not show the built-in account (local system for instance).
So how can you assign the built in account local system to Sharepoint Services?

Go to Sharepoint 2010 Management Shell


and use the following cmdlets:

$myservice= Get-SPServiceInstance | where {$_.TypeName -eq "put the service name here"}
$myservice.Service.ProcessIdentity.CurrentIdentityType = 0

Note that you can see the list with the available service names by executing the Get-SPServiceInstance cmdlet.