JFLarvoire / SysToolsLib

A library of Windows and Linux system management tools
Apache License 2.0
314 stars 93 forks source link

Can't start the PSService.ps1 service using the LocalService or NetworkService accounts #15

Open JFLarvoire opened 6 years ago

JFLarvoire commented 6 years ago

The updates checked in today allow running the PSService.ps1 service using any user account. This works fine with "normal" user accounts, provided they have the "Log on as a service" right. This also works well with the special LocalSystem account, which was the default account used until now. But this does not work with the special LocalService and NetworkService accounts: The SCM seems to be perfectly happy about them, and reports success in all cases. Yet, even though the PSService.exe stub starts, the PSService.ps1 -Service instance does not. I don't know why. I've written in the help screen that theses accounts do not have enough privileges to run PowerShell, but this is just a speculation. I'm still hoping that somebody can find a solution for these two accounts, as they actually are the ones recommended for running services!

Aorimn commented 6 years ago

A quick note on the last part of the last sentence: the recommended accounts for running services are now virtual service accounts (whether local or not). This doesn't bode well with the service in its current form, but this can be set with sc.exe once the service is installed, e.g.: &sc.exe config PSService obj= "NT SERVICE\PSService".