简体   繁体   中英

How to grant a user 'log on as a service' rights programmatically

I created a new user using the Windows 7 command line:

net user password /add

I want to use this user to start a newly-created service. However, it's not possible due to lack of "log on as a service" rights.

Is there a way to grant permissions to this user programmatically or by using the command line?

Programmatically, you would use the LsaAddAccountRight function to add the SE_SERVICE_LOGON_NAME right.

MSDN has a partial example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM