Skip to content

Instantly share code, notes, and snippets.

@if6was9
Created August 2, 2012 21:22
Show Gist options
  • Save if6was9/3240778 to your computer and use it in GitHub Desktop.
Save if6was9/3240778 to your computer and use it in GitHub Desktop.
Looks up a user in AD and returns the distinuighed name
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