How can I edit local security policy from a batch file?

Posted by Stephen Jennings on Server Fault See other posts from Server Fault or by Stephen Jennings
Published on 2010-04-16T14:22:48Z Indexed on 2010/04/16 14:33 UTC
Read the original article Hit count: 500

I am trying to write a utility as a batch file that, among other things, adds a user to the "Deny logon locally" local security policy. This batch file will be used on hundreds of independent computers (not on a domain and aren't even on the same network).

I assumed one of the following were my options, but perhaps there's one I haven't thought of.

  1. A command line utility similar to net.exe which can modify local security policy.

  2. A VBScript sample to do the same.

  3. Write my own using some WMI or Win32 calls. I'd rather not do this one if I don't have to.

© Server Fault or respective owner

Related posts about Windows

Related posts about batch-file