30May/08
PowerShell One Liner for Directory Lookup
Upon request from one of my coworkers, a one-liner for DN from an AD account name.
$a=read-host; $s=New-Object
directoryservices.directorysearcher("LDAP://dc=yerdomainhere");
$s.filter="(sAMAccountName=$a)"; $s.findone().path
Yeah, sad use of the semicolon I know, but it's a 2 minute job.