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

Getting user information in NT

by Anonymous Monk
on Aug 13, 2002 at 10:12 UTC ( [id://189733]=perlquestion: print w/replies, xml ) Need Help??

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

I seek knowlegde from the Monks of infinite wisdom for the solution to my problem:
I am trying to get user information, namely the name, to work in NT.
The User module allows me to get the login name, but not the actual name.
The getpwent etc. instructions only allow me to access the information in *nix
Is there a separate password file in Windows that I am unable to access?
In the home directory there is a ntuser.dat file that
may contain useful information, but I cannot access it
because the file is in use.

Any information to help me would be gratefully accepted,
but I am a fairly new user of the greatness that is perl,
so I would appreciate little or no obfuscation around the answer!
Thank you, Alex.

Replies are listed 'Best First'.
Re: Getting user information in NT
by Nightblade (Beadle) on Aug 13, 2002 at 10:25 UTC
    Try module Win32API::Net

    UserGetInfo(server, user, level, hash)

    Here is all user information you can get from Windows

    Level 3
    name, password, passwordAge, priv, homeDir, comment, flags, scriptPath, authFlags, fullName, usrComment, parms, workstations, lastLogon, lastLogoff, acctExpires, maxStorage, unitsPerWeek, logonHours, badPwCount, numLogons, logonServer, countryCode, codePage, userId, primaryGroupId, profile, homeDirDrive, passwordExpired

Re: Getting user information in NT
by atcroft (Abbot) on Aug 13, 2002 at 12:14 UTC
    You might also want to take a look at Perl for System Administration in regards to your question-as I recall, it contained some information about managing user account information and directory services, so there is a chance it might prove helpful as well.
Re: Getting user information in NT
by Necos (Friar) on Aug 13, 2002 at 17:24 UTC
    I'm surprised no one mentioned Win32::NetAdmin. There's a function called UserGetAttributes that will return everything that's in the Win32API::Net call. Also, just as a note, Windows will not return a password for a user (or at least I've never got it to return it for me). It's just a place holder for the underlying C/C++ call. Hope that helps some.

    Theodore Charles III
    Network Administrator
    Los Angeles Senior High
    4650 W. Olympic Blvd.
    Los Angeles, CA 90019
    323-937-3210 ext. 224
    email->secon_kun@hotmail.com
    perl -e "map{print++$_}split//,Mdbnr;"
Re: Getting user information in NT
by perigeeV (Hermit) on Aug 13, 2002 at 11:12 UTC

    On the resource kit:

    Usrstat.exe Displays user name, full name, and last logon date and time for each user account across all domain controllers.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-24 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found