JFLarvoire / SysToolsLib

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

Cant start service as a different user. #24

Open saaifali opened 4 years ago

saaifali commented 4 years ago

I have tried to install this service as different users using Credential param. I need it to run as a part of my automation to install windows services. With the PSService -Start command, the service logs as started. But it does not run the PSService -Service command to actually run the service. PSService -SCMstart works, but it is for test purposes only and also opens a window of my script execution which I donot want. How do I get to run the service as a different user?

JFLarvoire commented 4 years ago

Hello Saif,

This looks like an authorization issue. Did you make sure that the account you want to use for the service has the "Log on as a service" right?

Jean-François

----- Mail original -----

De: "Saif Ali" notifications@github.com À: "JFLarvoire/SysToolsLib" SysToolsLib@noreply.github.com Cc: "Subscribed" subscribed@noreply.github.com Envoyé: Lundi 2 Décembre 2019 13:05:30 Objet: [JFLarvoire/SysToolsLib] Cant start service as a different user. (#24)

I have tried to install this service as different users using Credential param. I need it to run as a part of my automation to install windows services. With the PSService -Start command, the service logs as started. But it does not run the PSService -Service command to actually run the service. PSService -SCMstart works, but it is for test purposes only and also opens a window of my script execution which I donot want. How do I get to run the service as a different user? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or unsubscribe .

saaifali commented 4 years ago

Yes. it does have log on as service rights. But does not start. I read in the previous issues that you have faced similar issues with other accounts? any solution?

JFLarvoire commented 4 years ago

I'm sorry, but I don't have any other idea for your case. Running under a different account works for many other people, so it should work for you too. Look in the event log for progress information, and possible error messages. Try adding more logging, to have more information on how far the various processes go before failing. And when you find what's wrong for you, please post it here to help others in the future.

Jean-François

----- Mail original -----

De: "Saif Ali" notifications@github.com À: "JFLarvoire/SysToolsLib" SysToolsLib@noreply.github.com Cc: "JFLarvoire" jf.larvoire@free.fr, "Comment" comment@noreply.github.com Envoyé: Mercredi 4 Décembre 2019 12:08:21 Objet: Re: [JFLarvoire/SysToolsLib] Cant start service as a different user. (#24)

Yes. it does have log on as service rights. But does not start. I read in the previous issues that you have faced similar issues with other accounts? any solution? — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or unsubscribe .