The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,692 other followers

Archive for August 10th, 2011

Windows authorization: Adding/Removing users from local groups

Posted by jpluimers on 2011/08/10

Though there are API ways to add users to local groups in Delphi, you need the JwaLmAccess unit from the JEDI API library project to import those.

Sometimes that is not feasible, and sometimes you want to just script things.

For those, you can use the Windows net localgroup command (if you have sufficient privileges, you can even apply it to the local groups on your domain controller by appending it with the /domain parameter, or use the net group /domain command to execute on global domain groups instead of local groups).

Sample of using this in a cmd script:

net localgroup Guests Me Myself I ACME\BugsBunny /delete

It will remove the local users Me, MySelf and I, and remove the domain user ACME\BugsBunny from the local group Guests.

Sample source of using this in Delphi: Read the rest of this entry »

Posted in CommandLine, Delphi, Development, Software Development | 1 Comment »

 
%d bloggers like this: