Get the DN of your Windows account from AD

You know how it is. A nice, nested OU structure in AD. Everything beautifully organised in containers with weird and wonderful names. There's a new guy who needs an account creating. Needs the same permissions as you. Simplest answer is to copy the account. But you didn't set your account up so you have no idea where in the beautifully organised tree it is.

For a quick answer, run this VBScript:

[text]set objSysInfo = CreateObject("ADSystemInfo")
set objUser = GetObject("LDAP://" & objSysInfo.UserName)
wscript.echo "DN: " & objUser.distinguishedName[/text]

Ah, found it. Of course, things would be much quicker with PowerShell but 4 hours ago I was the new guy and PowerShell doesn't really exists that side of the firewall yet 🙂