JFLarvoire / SysToolsLib

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

PSService.ps1 How to Run as a Domain User with Credentials #2

Closed forensicsguy20012004 closed 8 years ago

forensicsguy20012004 commented 8 years ago

Love the script...works flawlessly...how can I get the server to run as a logged in domain user? I have tried modifying the user once the service is running via the "services.exe" but once I change it away from the local system it will no longer start. Thanks...Matt

JFLarvoire commented 8 years ago

I don't know how to change the user identity If you find a way, please tell us!

Note that contrary to what you though, the initial version was not flawless. The service did not stop properly, and left a zombie process behind. I recommend that you use the updated version that I pushed yesterday. The fix comes at the cost of a more complex implementation, but it is also more powerful with support for multiple threads in the service task.

k3for commented 8 years ago

I got it to run as a service under a domain user service account - a couple of things you have to keep in mind: 1) the account needs to have the login as a service privilege. 2) after you set up the service with the -install switch but before you run it, you set the login account and restart options either with powershell or the services GUI, 3) you modify the isServices to accept the domain service account name as a system service account (I used an arraylist) 4) then you start the service manually from an interactive account that is not the domain service account.

forensicsguy20012004 commented 8 years ago

Hello Sir,

Is the new code out on your GitHub?

Matt

On Sat, Jun 11, 2016 at 8:56 PM, k3for notifications@github.com wrote:

I got it to run as a service under a domain user service account - a couple of things you have to keep in mind: 1) the account needs to have the login as a service privilege. 2) after you set up the service with the -install switch but before you run it, you set the login account and restart options either with powershell or the services GUI, 3) you modify the isServices to accept the domain service account name as a system service account (I used an arraylist) 4) then you start the service manually from an interactive account that is not the domain service account.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JFLarvoire/SysToolsLib/issues/2#issuecomment-225402960, or mute the thread https://github.com/notifications/unsubscribe/AMCkZ8thju3kjSO_ZeF6zH9ci0LIQWByks5qK1kigaJpZM4Itg1J .

JFLarvoire commented 8 years ago

Thanks for the explanation on how to configure it to run as a different user. The latest version, pushed last Thursday, is there: https://github.com/JFLarvoire/SysToolsLib/blob/master/PowerShell/PSService.ps1