Change Windows Service user programmatically

a 夏天 提交于 2019-12-05 04:00:37
trudger

It's because the account has no "Log On as service" privilege. You need to use LsaAddAccountRights to add such privilege to the account.

View this article please:

How To Manage User Privileges Programmatically in Windows NT

Do you notice any patterns amongst those failures? Same machine? Same OS? Same user? Does the user have "logon as service" or "logon interactively" rights? Personally, I am not familiar with this method of specifying the user for a service. I would have thought you would have to restart the service, but I guess not if it works 90% of the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!