Created
August 2, 2012 21:22
-
-
Save if6was9/3240778 to your computer and use it in GitHub Desktop.
Looks up a user in AD and returns the distinuighed name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set adsi= CREATEOBJECT("ADSystemInfo") | |
set nt= CREATEOBJECT("NameTranslate") | |
' Get the domain short name | |
adDomain= adsi.DomainShortName | |
' Prompt user for uid | |
user = INPUTBOX("Please enter username: ") | |
' Find the user's DN | |
nt.Init 1, adDomain | |
nt.SET 3, adDomain & "\" & user | |
dn = nt.GET(1) | |
' Display | |
WScript.Echo "DN: " & dn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment