I need to be able to grant rights to a user from a script (a batch file or JScript file). In particular, I want to grant SeServiceLogonRight to a particular domain account. I can't use NTRights.exe (not available on all target OS's), and I'd like to avoid having to write an executable in C just for this. Is it possible to do this with standard Windows tools, a WMI api, or anything else that can be used from a script?
+1
A:
AFAIK, no. You need either NTRights.exe or a custom tool or automation object that wraps the appropriate LsaXXX WinAPI functions.
Helen
2009-06-04 06:24:46
Alas, you're right.
JSBangs
2009-06-04 20:30:08
could you please paste that code which worked for this
taher chhabrawala
2010-06-04 13:36:32
@Taher, I can't paste the whole code, but basically what you need to do is call `LsaOpenPolicy` to get the access handle, and then `LsaAddAccountRights` to add the access rights to the given user object.
JSBangs
2010-06-04 15:13:12