Skip to content

Latest commit

 

History

History
 
 

Get-Unique

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Get-Unique oddities

Firstly, unlike almost all tools in PowerShell, Get-Unique is case sensitive. Not by default, it is just case sensitive, there is not an option to change this.

Secondly, Get-Unique requires its input to be pre-sorted. If this is not the case then one has to use Sort-Object. But Sort-Object has the option Unique itself, so that use of Get-Unique becomes redundant. Besides, Sort-Object provides the options Property, CaseSensitive, Culture.

Yet another alternative is Select-Object -Unique.

Get-Unique can be useful though. If only adjacent case sensitive duplicates should be removed then the cmdlet does this exactly. But the name is confusing.

Scripts


  • Microsoft Connect 77601
  • Microsoft Connect 872943