PowerTip: Get Unique Numbers by Using PowerShell


Summary: Easily get unique numbers from a list by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to get unique numbers from a list of numbers?

Hey, Scripting Guy! Answer Use the Get-Unique cmdlet, for example:

PS C:\> 1,2,2,3,4,4,5 | Get-Unique

1

2

3

4

5

Comments (2)

  1. Chen V says:

    Alternate methods
    1,2,2,3,4,4,5 | Select -Unique

    1,2,2,3,4,4,5 | Sort -Unique

Skip to main content