# this powershell snipped will retrieve the Distinguished Name of the user in AD # with the userprincipalname value as set in the script # this runs against the default AD server (GC) $searchObj= New-Object directoryServices.DirectorySearcher([adsi]('GC://'+([adsi]'LDAP://RootDse').RootDomainNamingContext)) $searchObj.filter="(&(objectclass=user)(userprincipalname=ExampleUser@ExampleDomain.com))" $users = $searchObj.Findall() $user = $users[0] $user.Properties.distinguishedname # output all the AD properties $user.Properties | format-list