Thursday, July 28, 2011

Get the Creator of an Active Directory Object with PowerShell

$userObject = [ADSI]"LDAP://localdc.mydomain.ad.local/CN=Smith\, John,OU=Users,DC=mydomain,DC=ad,DC=local,DC=com"
$objectOwner = $userObject.PSBase.get_ObjectSecurity().GetOwner([System.Security.Principal.NTAccount]).Value