external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Filter for unique objects.
Get-PSUnique [-InputObject] <Object> [-Property <String[]>] [<CommonParameters>]
You can use this command to filter for truly unique objects. That is, every property on every object is considered unique. Most things in PowerShell are already guaranteed to be unique, but you might import data from a CSV file with duplicate entries. Get-PSUnique can help filter.
This command works best with simple objects. Objects with nested objects as properties may not be properly detected. For complex objects, you might need to specify the property or properties to use for comparison.
PS C:\> $clean = Import-CSV c:\data\newinfo.csv | Get-PSUnique
Import unique objects from a CSV file and save the results to a variable.
Simple, objects. The flatter the better this command will work.
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specify a property to use for the comparison.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/