This should give you a start.  I’m not doing anything crazy here, just using Win32::Lanman to add the users.

 

 

use strict;

use warnings;

use Win32::Lanman;

 

my $server = 'computer';

my $userFile = 'users.txt';

my %users;

 

print "Importing users from $userFile...";

open(INFILE,"<$userFile") or die("Couldn't open '$userFile' for reading!\n");

while(my $line = <INFILE>){

      chomp $line;

      my ($user,$fullname,$pass,$comment) = split(':',$line);

      $users{$user} = [$fullname,$pass,$comment];

}

print "done.\n\n";

print "Importing users...\n\n";

 

foreach my $newUser(sort keys %users){

      print "\t$newUser...";

      my ($fullname,$pass,$comment) = @{$users{$newUser}};

     

      my %properties = (name => $newUser,

                                full_name => $fullname,

                                comment => $comment,

                                password => $pass);

     

     

      if(Win32::Lanman::NetUserAdd("\\\\$server",\%properties)){

            print "success!\n";

      }else{

            print "FAILED!\n";

      }

}

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eddie Willett
Sent: Tuesday, August 02, 2005 1:31 PM
To: perl-win32-admin@listserv.ActiveState.com
Subject: Adding local users

 

Anyone have a good way to add local users to workstations quickly?

 

Eddie



______________________________________________________________________
This email transmission and any documents, files or previous email
messages attached to it may contain information that is confidential or
legally privileged. If you are not the intended recipient or a person
responsible for delivering this transmission to the intended recipient,
you are hereby notified that you must not read this transmission and
that any disclosure, copying, printing, distribution or use of this
transmission is strictly prohibited. If you have received this transmission
in error, please immediately notify the sender by telephone or return email
and delete the original transmission and its attachments without reading
or saving in any manner.

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to