views:

512

answers:

1

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
Alas, you're right.
JSBangs
could you please paste that code which worked for this
taher chhabrawala
@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