List a users First and Last name when called with a Distinguished Name.
'uname.vbs
' Display First and Last name for a given DN
On Error Resume Next
Dim objUser, strDN
strDN = WScript.Arguments.Item(0)
Set objUser = GetObject("LDAP://" & strDN)
WScript.Echo "First name: " & objUser.givenName
WScript.Echo "Last name: " & objUser.sn
WScript.Echo "Display name: " & objUser.displayName
Example
cscript //Nologo uname.vbs "CN=johndoe,OU=Users,DC=ss64,DC=com"
“Always end the name of your child with a vowel, so that when you yell the name will carry” ~ Bill Cosby
Related:
UserInfo - List User properties (as shown in ADUC)
© Copyright SS64.com 1999-2013
Some rights reserved