Solved

Help with Win32::NetAdmin

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

20 Experts available now in Live!

Get 1:1 Help Now