How-to: List User Information from Active Directory

List User properties as displayed in ADUC

'userinfo.vbs

' Usage:
'       cscript //Nologo userinfo.vbs

' List User properties as displayed in ADUC

On Error Resume Next
Dim objSysInfo, objUser
Set objSysInfo = CreateObject("ADSystemInfo")

' Currently logged in User
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
 ' or specific user:
 'Set objUser = GetObject("LDAP://CN=johndoe,OU=Users,DC=ss64,DC=com")

WScript.Echo "DN: " & objUser.distinguishedName

WScript.Echo ""
WScript.Echo "GENERAL"
WScript.Echo "Given name: " & objUser.givenName
'WScript.Echo "Given name: " & objUser.FirstName
WScript.Echo "Initials: " & objUser.initials
WScript.Echo "Last name: " & objUser.sn
'WScript.Echo "Last name: " & objUser.LastName
WScript.Echo "Display name: " & objUser.displayName
'WScript.Echo "Display name: " & objUser.FullName
WScript.Echo "Description: " & objUser.description
WScript.Echo "Office: " & objUser.physicalDeliveryOfficeName
WScript.Echo "Telephone number: " & objUser.telephoneNumber
WScript.Echo "Other Telephone numbers: " & objUser.otherTelephone
WScript.Echo "Email: " & objUser.mail
' WScript.Echo "Email: " & objUser.EmailAddress
WScript.Echo "Web page: " & objUser.wWWHomePage
WScript.Echo "Other Web pages: " & objUser.url
WScript.Echo ""
WScript.Echo "ADDRESS"
WScript.Echo "Street: " & objUser.streetAddress
WScript.Echo "P.O. Box: " & objUser.postOfficeBox
WScript.Echo "City: " & objUser.l
WScript.Echo "State/province: " & objUser.st
WScript.Echo "Zip/Postal Code: " & objUser.postalCode
WScript.Echo "Country/region: " & objUser.countryCode
'WScript.Echo "Country/region: " & objUser.c    '(ISO 4217)
WScript.Echo ""
WScript.Echo "ACCOUNT"
WScript.Echo "User logon name: " & objUser.userPrincipalName
WScript.Echo "pre-Windows 2000 logon name: " & objUser.sAMAccountName
WScript.Echo "AccountDisabled: " & objUser.AccountDisabled
' WScript.Echo "Account Control #: " & objUser.userAccountControl
WScript.Echo "Logon Hours: " & objUser.logonHours
WScript.Echo "Logon On To (Logon Workstations): " & objUser.userWorkstations
' WScript.Echo "User must change password at next logon: " & objUser.pwdLastSet
WScript.Echo "User cannot change password: " & objUser.userAccountControl
WScript.Echo "Password never expires: " & objUser.userAccountControl
WScript.Echo "Store password using reversible encryption: " & objUser.userAccountControl
' WScript.Echo "Account expires end of (date): " & objUser.accountExpires
WScript.Echo ""
WScript.Echo "PROFILE"
WScript.Echo "Profile path: " & objUser.profilePath
' WScript.Echo "Profile path: " & objUser.Profile
WScript.Echo "Logon script: " & objUser.scriptPath
WScript.Echo "Home folder, local path: " & objUser.homeDirectory
WScript.Echo "Home folder, Connect, Drive: " & objUser.homeDrive
WScript.Echo "Home folder, Connect, To:: " & objUser.homeDirectory
WScript.Echo ""
WScript.Echo "TELEPHONE"
WScript.Echo "Home: " & objUser.homePhone
WScript.Echo "Other Home phone numbers: " & objUser.otherHomePhone
WScript.Echo "Pager: " & objUser.pager
WScript.Echo "Other Pager numbers: " & objUser.otherPager
WScript.Echo "Mobile: " & objUser.mobile
WScript.Echo "Other Mobile numbers: " & objUser.otherMobile
WScript.Echo "Fax: " & objUser.facsimileTelephoneNumber
WScript.Echo "Other Fax numbers: " & objUser.otherFacsimileTelephoneNumber
WScript.Echo "IP phone: " & objUser.ipPhone
WScript.Echo "Other IP phone numbers: " & objUser.otherIpPhone
WScript.Echo "Notes: " & objUser.info
WScript.Echo ""
WScript.Echo "ORGANISATION"
WScript.Echo "Job Title: " & objUser.title
WScript.Echo "Department: " & objUser.department
WScript.Echo "Company: " & objUser.company
WScript.Echo "Manager: " & objUser.manager
List of all User Attributes
   
Attribute Description
accountExpires  
aCSPolicyName  
adminCount  
adminDescription  
adminDisplayName  
allowedAttributes  
allowedAttributesEffective  
allowedChildClasses  
allowedChildClassesEffective  
assistant  
attributeCertificateAttribute  
audio  
badPasswordTime  
badPwdCount  
bridgeheadServerListBL  
businessCategory  
businessRoles  
c Country Abbreviation
canonicalName  
carLicense  
cn Name
co Country
codePage  
comment  
company  
controlAccessRights  
countryCode  
createTimeStamp  
dBCSPwd  
defaultClassStore  
department  
departmentNumber  
description  
desktopProfile  
destinationIndicator  
directReports  
displayName  
displayNamePrintable  
distinguishedName  
division  
dSASignature  
dSCorePropagationData  
DUP-houseIdentifier-SID  
DUP-secretary-SID  
dynamicLDAPServer  
employeeID  
employeeNumber  
employeeType  
extensionName  
facsimileTelephoneNumber  
flags  
fromEntry  
frsComputerReferenceBL  
fRSMemberReferenceBL  
fSMORoleOwner  
generationQualifier  
givenName  
groupMembershipSAM  
groupPriority  
groupsToIgnore  
homeDirectory  
homeDrive  
homePhone  
homePostalAddress  
initials  
instanceType  
internationalISDNNumber  
ipPhone  
isCriticalSystemObject  
isDeleted  
isPrivilegeHolder  
isRecycled  
jpegPhoto  
kMServer  
l City
labeledURI  
lastKnownParent  
lastLogoff  
lastLogon  
lastLogonTimestamp  
lmPwdHistory  
localeID  
lockoutTime  
logonCount  
logonHours  
logonWorkstation  
mail EMail Address
managedObjects  
manager  
masteredBy  
maxStorage  
memberOf  
mhsORAddress  
middleName  
mobile  
modifyTimeStamp  
msCOM-PartitionSetLink  
msCOM-UserLink  
msCOM-UserPartitionSetLink  
msDFSR-ComputerReferenceBL  
msDFSR-MemberReferenceBL  
msDRM-IdentityCertificate  
msDS-AllowedToActOnBehalfOfOtherIdentity  
msDS-AllowedToDelegateTo  
msDS-Approx-Immed-Subordinates  
msDS-AssignedAuthNPolicy  
msDS-AssignedAuthNPolicySilo  
msDS-AuthenticatedAtDC  
msDS-AuthenticatedToAccountlist  
msDS-AuthNPolicySiloMembersBL  
msDS-Cached-Membership  
msDS-Cached-Membership-Time-Stamp  
msDS-ClaimSharesPossibleValuesWithBL  
msDS-CloudAnchor  
mS-DS-ConsistencyChildCount  
mS-DS-ConsistencyGuid  
mS-DS-CreatorSID  
msDS-EnabledFeatureBL  
msDS-FailedInteractiveLogonCount  
msDS-FailedInteractiveLogonCountAtLastSuccessfulLogon  
msDS-HABSeniorityIndex  
msDS-HostServiceAccountBL  
msDS-IsDomainFor  
msDS-IsFullReplicaFor  
msDS-IsPartialReplicaFor  
msDS-IsPrimaryComputerFor  
msDS-KeyCredentialLink  
msDS-KeyPrincipalBL  
msDS-KrbTgtLinkBl  
msDS-LastFailedInteractiveLogonTime  
msDS-LastKnownRDN  
msDS-LastSuccessfulInteractiveLogonTime  
msDS-LocalEffectiveDeletionTime  
msDS-LocalEffectiveRecycleTime  
msDs-masteredBy  
msds-memberOfTransitive  
msDS-MembersForAzRoleBL  
msDS-MembersOfResourcePropertyListBL  
msds-memberTransitive  
msDS-NCReplCursors  
msDS-NCReplInboundNeighbors  
msDS-NCReplOutboundNeighbors  
msDS-NC-RO-Replica-Locations-BL  
msDS-NcType  
msDS-NonMembersBL  
msDS-ObjectReferenceBL  
msDS-ObjectSoa  
msDS-OIDToGroupLinkBl  
msDS-OperationsForAzRoleBL  
msDS-OperationsForAzTaskBL  
msDS-parentdistname  
msDS-PhoneticCompanyName  
msDS-PhoneticDepartment  
msDS-PhoneticDisplayName  
msDS-PhoneticFirstName  
msDS-PhoneticLastName  
msDS-preferredDataLocation  
msDS-PrimaryComputer  
msDS-PrincipalName  
msDS-PSOApplied  
msDS-ReplAttributeMetaData  
msDS-ReplValueMetaData  
msDS-ReplValueMetaDataExt  
msDS-ResultantPSO  
msDS-RevealedDSAs  
msDS-RevealedListBL  
msDS-SecondaryKrbTgtNumber  
msDS-Site-Affinity  
msDS-SourceAnchor  
msDS-SourceObjectDN  
msDS-SupportedEncryptionTypes  
msDS-SyncServerUrl  
msDS-TasksForAzRoleBL  
msDS-TasksForAzTaskBL  
msDS-TDOEgressBL  
msDS-TDOIngressBL  
msDS-User-Account-Control-Computed  
msDS-UserPasswordExpiryTimeComputed  
msDS-ValueTypeReferenceBL  
msExchAcceptedDomainBL  
msExchAccountForestBL  
msExchAdministrativeUnitBL  
msExchArchiveDatabaseBL  
msExchAssociatedAcceptedDomainBL  
msExchAuthPolicyBL  
msExchAuxMailboxParentObjectIdBL  
msExchAvailabilityOrgWideAccountBL  
msExchAvailabilityPerUserAccountBL  
msExchCatchAllRecipientBL  
msExchConferenceMailboxBL  
msExchControllingZone  
msExchDataEncryptionPolicyBL  
msExchDelegateListBL  
msExchDeviceAccessControlRuleBL  
msExchEvictedMemebersBL  
msExchHABRootDepartmentBL  
msExchHouseIdentifier  
msExchHygieneConfigurationMalwareBL  
msExchHygieneConfigurationSpamBL  
msExchIMAPOWAURLPrefixOverride  
msExchIntendedMailboxPlanBL  
msExchMailboxMoveSourceArchiveMDBBL  
msExchMailboxMoveSourceMDBBL  
msExchMailboxMoveSourceUserBL  
msExchMailboxMoveStorageMDBBL  
msExchMailboxMoveTargetArchiveMDBBL  
msExchMailboxMoveTargetMDBBL  
msExchMailboxMoveTargetUserBL  
msExchMDBAvailabilityGroupConfigurationBL  
msExchMobileRemoteDocumentsAllowedServersBL  
msExchMobileRemoteDocumentsBlockedServersBL  
msExchMobileRemoteDocumentsInternalDomainSuffixListBL  
msExchMultiMailboxDatabasesBL  
msExchMultiMailboxLocationsBL  
msExchOABGeneratingMailboxBL  
msExchOrganizationsAddressBookRootsBL  
msExchOrganizationsGlobalAddressListsBL  
msExchOrganizationsTemplateRootsBL  
msExchOriginatingForest  
msExchOWAAllowedFileTypesBL  
msExchOWAAllowedMimeTypesBL  
msExchOWABlockedFileTypesBL  
msExchOWABlockedMIMETypesBL  
msExchOWAForceSaveFileTypesBL  
msExchOWAForceSaveMIMETypesBL  
msExchOWARemoteDocumentsAllowedServersBL  
msExchOWARemoteDocumentsBlockedServersBL  
msExchOWARemoteDocumentsInternalDomainSuffixListBL  
msExchOWATranscodingFileTypesBL  
msExchOWATranscodingMimeTypesBL  
msExchParentPlanBL  
msExchQueryBaseDN  
msExchRBACPolicyBL  
msExchResourceGUID  
msExchResourceProperties  
msExchRMSComputerAccountsBL  
msExchServerAssociationBL  
msExchServerSiteBL  
msExchSMTPReceiveDefaultAcceptedDomainBL  
msExchSupervisionDLBL  
msExchSupervisionOneOffBL  
msExchSupervisionUserBL  
msExchTransportRuleTargetBL  
msExchTrustedDomainBL  
msExchUGEventSubscriptionBL  
msExchUGMemberBL  
msExchUserBL  
msExchUserCulture  
msIIS-FTPDir  
msIIS-FTPRoot  
mSMQDigests  
mSMQDigestsMig  
mSMQSignCertificates  
mSMQSignCertificatesMig  
msNPAllowDialin  
msNPCallingStationID  
msNPSavedCallingStationID  
msOrg-LeadersBL  
msPKIAccountCredentials  
msPKI-CredentialRoamingTokens  
msPKIDPAPIMasterKeys  
msPKIRoamingTimeStamp  
msRADIUSCallbackNumber  
msRADIUS-FramedInterfaceId  
msRADIUSFramedIPAddress  
msRADIUS-FramedIpv6Prefix  
msRADIUS-FramedIpv6Route  
msRADIUSFramedRoute  
msRADIUS-SavedFramedInterfaceId  
msRADIUS-SavedFramedIpv6Prefix  
msRADIUS-SavedFramedIpv6Route  
msRADIUSServiceType  
msRASSavedCallbackNumber  
msRASSavedFramedIPAddress  
msRASSavedFramedRoute  
msRTCSIP-AcpInfo  
msRTCSIP-ApplicationOptions  
msRTCSIP-ArchivingEnabled  
msRTCSIP-DeploymentLocator  
msRTCSIP-FederationEnabled  
msRTCSIP-GroupingID  
msRTCSIP-InternetAccessEnabled  
msRTCSIP-Line  
msRTCSIP-LineServer  
msRTCSIP-OptionFlags  
msRTCSIP-OriginatorSid  
msRTCSIP-OwnerUrn  
msRTCSIP-PrimaryHomeServer  
msRTCSIP-PrimaryUserAddress  
msRTCSIP-PrivateLine  
msRTCSIP-TargetHomeServer  
msRTCSIP-TargetUserPolicies  
msRTCSIP-TenantId  
msRTCSIP-UserEnabled  
msRTCSIP-UserExtension  
msRTCSIP-UserLocationProfile  
msRTCSIP-UserPolicies  
msRTCSIP-UserPolicy  
msRTCSIP-UserRoutingGroupId  
msSFU30Name  
msSFU30NisDomain  
msSFU30PosixMemberOf  
msTSAllowLogon  
msTSBrokenConnectionAction  
msTSConnectClientDrives  
msTSConnectPrinterDrives  
msTSDefaultToMainPrinter  
msTSExpireDate  
msTSExpireDate2  
msTSExpireDate3  
msTSExpireDate4  
msTSHomeDirectory  
msTSHomeDrive  
msTSInitialProgram  
msTSLicenseVersion  
msTSLicenseVersion2  
msTSLicenseVersion3  
msTSLicenseVersion4  
msTSLSProperty01  
msTSLSProperty02  
msTSManagingLS  
msTSManagingLS2  
msTSManagingLS3  
msTSManagingLS4  
msTSMaxConnectionTime  
msTSMaxDisconnectionTime  
msTSMaxIdleTime  
msTSPrimaryDesktop  
msTSProfilePath  
msTSProperty01  
msTSProperty02  
msTSReconnectionAction  
msTSRemoteControl  
msTSSecondaryDesktops  
msTSWorkDirectory  
name  
netbootSCPBL  
networkAddress  
nonSecurityMemberBL  
ntPwdHistory  
nTSecurityDescriptor  
o  
objectCategory  
objectClass  
objectGUID  
objectVersion  
operatorCount  
otherFacsimileTelephoneNumber  
otherHomePhone  
otherIpPhone  
otherLoginWorkstations  
otherMailbox EMail Address (Others)
otherMobile  
otherPager  
otherTelephone  
otherWellKnownObjects  
ou  
ownerBL  
pager  
partialAttributeDeletionList  
partialAttributeSet  
personalPager  
personalTitle Title (Mr/Mrs/Miss etc)
photo  
physicalDeliveryOfficeName Office Location
possibleInferiors  
postalAddress  
postalCode  
postOfficeBox  
preferredDeliveryMethod  
preferredLanguage  
preferredOU  
primaryGroupID  
primaryInternationalISDNNumber  
primaryTelexNumber  
profilePath  
proxiedObjectName  
proxyAddresses  
pwdLastSet  
queryPolicyBL  
registeredAddress  
replPropertyMetaData  
replUpToDateVector  
repsFrom  
repsTo  
revision  
roomNumber  
scriptPath  
sDRightsEffective  
seeAlso  
serialNumber  
serverReferenceBL  
servicePrincipalName  
showInAdvancedViewOnly  
siteObjectBL  
sn  
st State/Province
street  
streetAddress  
structuralObjectClass  
subRefs  
subSchemaSubEntry  
systemFlags  
telephoneAssistant  
telephoneNumber  
teletexTerminalIdentifier  
telexNumber  
terminalServer  
thumbnailLogo  
thumbnailPhoto  
title Job Title
uid  
unicodePwd  
url  
userAccountControl  
userCertificate  
userParameters  
userPassword  
userPKCS12  
userPrincipalName  
userSharedFolder  
userSharedFolderOther  
userSMIMECertificate  
userWorkstations  
uSNChanged  
uSNCreated  
uSNDSALastObjRemoved  
USNIntersite  
uSNLastObjRem  
uSNSource  
wbemPath  
wellKnownObjects  
whenChanged  
whenCreated  
wWWHomePage  
x121Address  
x500uniqueIdentifier  

“Nearly all men can stand adversity, but if you want to test a man's character, give him power” ~ Abraham Lincoln

Related VBScript commands

ComputerInfo - List Computer properties (as shown in ADUC).
Active Directory / LDAP User Attributes.
ListUsers - VBScript to List all Users.
UserName - List user's simple name when called with a Distinguished Name.
SearchAD - Search AD for either Users, Computers or groups.
PowerShell: Get-ADUser User64 -Properties *
PowerShell script to retrieve all attributes of an Active Directory User object, including inherited.
adschema attributes - docs.microsoft.com


 
Copyright © 1999-2024 SS64.com
Some rights reserved