I don't understand what you are asking for. Please give an example...
From: [email protected] [mailto:[email protected]] On
Behalf Of Aakash Shah
Sent: Wednesday, November 12, 2014 9:59 PM
To: [email protected]
Subject: [powershell] Search For OU Using Filter With CanonicalName in AD
Is there a clean/efficient way to filter for a canonical name in AD? I tried
the following but it did not work:
Get-ADOrganizationalUnit -Filter 'CanonicalName -eq "domain.com/OU"'
-Properties 'CanonicalName'
When I looked up other solutions, I found some sources where the string is
parsed and manually pieced together as a DN entry, but I would like to avoid
that preferably. I was able to previously do this with the Quest cmdlets but I
am working on moving away from them and am trying to find equivalent
approaches, if possible.
I can pipe Get-ADOrganizationalUnit to a Where cmdlet to then do a search, but
it is much slower:
Get-ADOrganizationalUnit -Filter * -Properties 'CanonicalName' | Where-Object
{$_.CanonicalName -eq 'domain.com/OU'}
Or, if anyone has information on using built in commands to convert a canonical
name to a DN value, that would also be appreciated (the solutions I found also
manually pieced each block together).
Thanks,
-Aakash Shah
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1