Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Using Win32::NetAdmin to change passwords

by RayRay459 (Pilgrim)
on Aug 15, 2001 at 02:48 UTC ( [id://104907]=perlquestion: print w/replies, xml ) Need Help??

RayRay459 has asked for the wisdom of the Perl Monks concerning the following question:

In the Win32::NetAdmin module i am going to use the UserSetAttributes to change the administrator password, however...there is alot of other fields that i do not wish to use...example the man page shows UserSetAttributes(server, username, password, passwordAge,privilege,homeDir, comment, flags, scriptPath). I only need to use the first 3. is there a way to specify that or do i have to assign values to the rest of them. Any help would be appreciated. Ray
# Ray Espinoza # ChPass.pl # TO change local admin pass on remote machine #################################################### #!D:\perl\bin -w use strict; use Win32::NetAdmin qw(SetUserAttributes); chomp(my $server = <STDIN>); my $userAcct = "Administrator"; my $Pass = "387SetHike"; UserSetAttributes($server, $userAcct, $Pass) || die "UserSetAttributes() failed: $^E";
I get this error when i try to run this:
"SetUserAttributes" is not exported by the Win32::NetAdmin module at C +:\ perl\ChPass.pl line 9 Can't continue after import errors at C:\scripts\perl\ChPass.pl line 9 BEGIN failed--compilation aborted at C:\scripts\perl\ChPass.pl line 9.

Replies are listed 'Best First'.
Re: Using Win32::NetAdmin to change passwords (boo)
by boo_radley (Parson) on Aug 15, 2001 at 06:46 UTC
    May I suggest using Win32::AdminMisc? It should be installed if you've got the activeperl distribution, and contains the popular and delightful UserChangePassword( $Domain , $User, $OldPassword, $NewPassword ).

    Note that this function returns errors through $^E, not $!. At least $! was consistently undef'd when UserChangePassword failed. Also note that your passwords are still restricted to the domain's policies; it's quite feasable that you lock an account out after x tries!

Re: Using Win32::NetAdmin to change passwords
by OzzyOsbourne (Chaplain) on Aug 15, 2001 at 15:44 UTC

    You could set all the unwanted variables to $x...

    Update: An even better way might be to set the undesirable varaibles to undef rahter than $x.

    -OzzyOsbourne

Re: Using Win32::NetAdmin to change passwords
by joefission (Monk) on Aug 15, 2001 at 17:00 UTC
    Maybe it is just as simple as using UserSetAttributes instead of SetUserAttributes on line 9?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://104907]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found