user info





3
Date Submitted Thu. Mar. 2nd, 2006 10:08 AM
Revision 1 of 1
Syntax Master dannyboy
Tags ADSI | USERINFO | VBSCRIPT
Comments 0 comments
This small script prompts you for a user name or gets it from the command line and shows you information about a user including what groups they are in.

Dim DomainString
Dim UserObj
Dim GroupObj
Dim lstrUserName
Dim lbTrueFalse

' Put your domain name HERE

DomainString = "DOMAIN"

lstrUserName = GetUserName

Set UserObj = GetObject("WinNT://" & DomainString & "/" & lstrUserName)
wscript.echo "UserAuthor:         " & UserObj.Name
wscript.echo "Full Author:        " & UserObj.FullName
wscript.echo "Login ~~Script~~.     " & UserObj.LoginScript
wscript.echo "Description:      " & UserObj.Description
wscript.echo "Home Directory:   " & UserObj.HomeDirectory
wscript.echo "Profile Path:     " & UserObj.Profile
wscript.echo "Account Locked:   " & UserObj.IsAccountLocked
wscript.echo "Account Disabled: " & UserObj.AccountDisabled

wscript.echo "User is a member of:"
For Each GroupObj in UserObj.Groups
        wscript.echo GroupObj.Name & " (" & GroupObj.Description & ")"
Next
            

'
********************************************************************************************************************
'***    Get user's name from command line parameters or prompt for input
'********************************************************************************************************************

Function GetUserName()

        Dim tempUserName

        set oArgs=wscript.arguments

        If oArgs.Count <> 1 Then
                tempUserName = InputBox ("Enter the Users Author:","User Info Inquiry")
                If tempUserName = "" Then
                  WScript.Quit
                End If
        Else
            tempUserName = oArgs.item(0)
        End If

        GetUserName = tempUserName
End Function

 

Comments

There are currently no comments for this snippet.

Voting