Solved

Help with Win32::NetAdmin

Posted on 1998-07-22
3
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

710 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