Search code examples
stringpowershellunique

How do I get unique values from this array in PowerShell?


Why is the code below returning $null? I'm trying to store just unique values.

$DailyPathsToDelete = @("C:\temp\IMG000483\","C:\temp\IMG000483\")
$DailyPathsToDelete = Select-Object $DailyPathsToDelete -Unique 

Solution

  • You can try :

    $unique = $DailyPathsToDelete | Get-Unique