I recently used this as the basis for a customer need, and really appreciated this.



I needed to make a slight modification to allow the service to run under a service account other than localsystem, in order to perform some network operations, something like (around line 773 in the latest version of code), plus a function anywhere that allows for flexibility in how many / variety / testing of service accounts in your environment)



$isSystem = IsSystemAccount -user $userName



Function IsSystemAccount { Param ( [string] $user ) $isSsytemResult = $false if ($user -match "myServiceAccountName") { $isSystemResult = $true } return $isSsytemResult }





You also need to set the service to run under the service account, and all the recovery options, but there's other powershell to do that.



