Sunday, 15 May 2011

Remove duplicate entries from PowerShell object while keeping PSObject intact -



Remove duplicate entries from PowerShell object while keeping PSObject intact -

i have created psobject multiple properties. remove duplicate entries psobject using specific property reference.

i'd while keeping psobject in original format.

examples have seen extract non-duplicate values. want delete duplicate values.

i'm trying turn this:

distinguishedname name ----------------- ---- ou=users,dc=domain,dc=local users ou=users,dc=domain,dc=local users

into this:

distinguishedname name ----------------- ---- ou=users,dc=domain,dc=local users

i have feeling i'm missing trick here...

thanks

that looks format-table output of collection of psobjects same properties.

to weed out duplicates, utilize sort-object -unique:

$uniqobjects = $psobjects |sort-object -unique

powershell duplicates psobject

No comments:

Post a Comment