I'm using the code below to map the O drive only if the user is a member of
group testgroup.  It works, but sometimes I get error 1314, a required
privilege is not held by the client. I'm running the perl code from the
login script.
Anyone see what I might be missing? Or a better way to do this?
Thank you.


use Win32::Lanman;
use Win32::NetResource;

$group = 'testgroup';
$server = 'yyyyyy';
$passwd = 'xxxxxx';
$persistent = 0;
$connect_as_user = 'testserver\\testuser';

%NetResource = (

                 "LocalName" => "O:", "RemoteName" =>"
\\\\testserver\\test");


$current_user = Win32::LoginName();
#print "current user is $current_user\n";

if(!Win32::Lanman::NetGroupGetUsers("\\\\yyyyyy", "testgroup", \@users))
 {
        print "Sorry, something went wrong; error: ";
        # get the error code
        print Win32::Lanman::GetLastError();
        exit 1;
 }

 foreach $user (@users)
 {

   if (${$user}{'name'} eq $current_user)

   {

      #print "user is a member of the group $group - mapping drive\n\n";
      if (Win32::NetResource::AddConnection
(\%NetResource,$passwd,$connect_as_user,$persistent))
      {
         #print "successfully established connection\n\n";
         exit(0);

      }

   }


 }


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to