Posted on Leave a comment

query AD with Hex ObjectGUID

In Powershell:

get-aduser -LDAPFilter "(&(objectClass=user)(objectGUID=\02\8B\28\AF\48\4F\32\4A\88\B6\0D\B1\30\57\82\F3))"

In Transact-SQL

SELECT *
FROM OPENQUERY(ADSI,'SELECT cn, ADsPath FROM ''LDAP://DC=myDC,DC=myDC2'' WHERE objectGUID=''\02\8B\28\AF\48\4F\32\4A\88\B6\0D\B1\30\57\82\F3'' ')