Solved

Help with Win32::NetAdmin

Posted on 1998-07-22
3
296 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now