Tuesday, January 4, 2011

Get Object Active Directory Domain from distinguishedName

$distinguishedName = "CN=Doe\, John,OU=Advertising,OU=User,OU=New York,OU=Accounts,DC=usa,DC=corp,DC=foobar,DC=local"
$objectDomain = ((($distinguishedName -replace "(.*?)DC=(.*)",'$2') -replace "DC=","") -replace ",",".")

No comments:

Post a Comment