Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi, I looked in my Roths Win32 Perl Scripting book and found several references to backing up and restoring machine and user accounts (pg 129). Also chapter 2 talks about Account Maintenance. I could only find a small reference on pg 200 that talks about group membership. I'll type it up if you like.

Most of the scripts relating to user and group stuff is Lanman though, maybe worth a look..? (Btw I think Jenda is responsible for this..)

This may also be worth a look..

I then looked at my Roths Win32 Perl Programming bookand think I found what you are looking for. On page 126 there is a section about Group Account Management which talks about Adding groups and adding users to groups. So here is a quick snippet. it uses win32::netadmin.

#! /usr/bin/perl use Win32::NetAdmin; my $machine = "\\\\server1"; my $group = "TestGroup"; my @users = qw(AcidHawk Fred Sally Bill); my $server = ""; Win32::NetAdmin::GroupCreate( $machine, $group, "This is a test group" +) or die "Cannot create group\n"; my $result = Win32::NetAdmin::LocalGroupAddUsers( $server, $group, \@u +sers); if ($result) { print "Successfully added users to $group\n"; } else { print "Failed to add users to $group\n"; }

Update: cpan:Win32::NetAdmin does have the following which may help

GroupGetMembers(server, groupName, userArrayRef) Fills userArrayRef with the members of groupName.
and
LocalGroupGetMembers(server, groupName, userArrayRef) Fills userArrayRef with the members of groupName.
as well as
GroupAddUsers(server, groupName, users) Adds a user to a group.
and
LocalGroupAddUsers(server, groupName, users) Adds a user to a group.
HTH..

-----
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Re: (3) Win32 local users and groups modules by AcidHawk
in thread Win32 local users and groups modules by waswas-fng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found