Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with Win32::NetAdmin

Posted on 1998-07-22
3
Medium Priority
?
321 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

879 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