locked
sort -unique get-Unique issue why? RRS feed

  • Question

  • I have an array $a see below. Why I am getting 2 different output when I do

    Get-Unique

    sort -Unique

    I am supposed to get same out-put am I right?

    $a=@("WeekendBackups","MSDE_Backup", "Logs","MSDE_Backup","Logs") PS C:\script\FourStar> $a | Get-Unique WeekendBackups MSDE_Backup Logs MSDE_Backup Logs

    PS C:\script\FourStar> $a | sort -Unique Logs MSDE_Backup WeekendBackups



    • Edited by asif300 Tuesday, November 7, 2017 8:25 PM
    Tuesday, November 7, 2017 8:17 PM

Answers

  • help get-unique -online

    Command requires a sorted input.

    $a|sort |Get-Unique


    \_(ツ)_/

    • Marked as answer by asif300 Tuesday, November 7, 2017 8:26 PM
    Tuesday, November 7, 2017 8:24 PM