Solved

Help with Win32::NetAdmin

Posted on 1998-07-22
3
302 Views
Last Modified: 2008-02-26
Can you please tell me how to use the NetAdmin package.  I have used other packages but I cannot get NetAdmin to work.  Some example code would be very helpfull...

Thank you,
Louis
0
Comment
Question by:masteryoda
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
alamo earned 100 total points
ID: 1208620
Here is the example from the documentation. I ran it and it worked perfectly for me, first time. (It didn't print anything but the user was there in User Manager). Note that according to the NetAdmin package documentation this function works on NT only, it won't work on 95 (which makes sense since 95 doesn't have real "users" like NT does).

Hope this helps!

use Win32::NetAdmin;
# set info for the user.
$userName = 'TestUser';
$password = '';
$passwordAge = 0;
$privilege = USER_PRIV_USER;
$homeDir = 'c:\\';
$comment = 'This is a test user';
$flags = UF_SCRIPT;
$scriptpath = 'C:\\';
$groupName = 'TestGroup';
$groupComment = "This is a test group";
Win32::NetAdmin::UserCreate('', $userName,
                       $password,
                       $passwordAge,
                       $privilege,
                       $homeDir,
                       $comment,
                       $flags,
                       $scriptpath) || print "not ";

Win32::NetAdmin::UserGetAttributes('',$userName,
                       $Getpassword,
                       $GetpasswordAge,
                       $Getprivilege,
                       $GethomeDir,
                       $Getcomment,
                       $Getflags,
                       $Getscriptpath) || warn();

($password eq $Getpassword) || warn();
($passwordAge == $GetpasswordAge) || warn();
($homeDir eq $GethomeDir) || warn();
($comment eq $Getcomment) || warn();
($flags == ($Getflags&USER_PRIV_MASK)) || warn();
($scriptpath eq $scriptpath) || warn();

0
 

Author Comment

by:masteryoda
ID: 1208621
This is very helpfull.  I have one more question though.  What documentation are you looking at.  And how can I get a copy of it.

Louis
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208622
I am looking at the doc which comes with perl for Win32 from http://www.ActiveState.com/, it's win32mod.html in the docs/Perl-Win32/ directory under perl5. You may already have it, but it not it's online at activestate at http://www.ActiveState.com/reference/Perl/Perl-Win32/win32mod.html

Good luck!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTTP Error 502.2 - Bad Gateway 3 222
Expect & sshpass package for Solaris 10 x86 15 961
compress files in RAR using perl 13 84
Perl Snippet to Parse String 1 22
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question