0

using test script on my printserver I'm getting some output:

Name                                                                                                                        
----                                                                                                                        
dnj-500.1                                                                                                                   
dnj-500.1                                                                                                                   
dnj-4000.1                                                                                                                  
3015.6                                                                                                                      
3015.05 

I need to launch foreach or same process for this, but before that I need to delete one of dnj-500.1 strings. How can I do this via powershell?

Utka Kanibal
  • 31
  • 2
  • 10

2 Answers2

1

Both approaches work. Be sure, to select the right column (Name):

(I used get-process for demonstration purpose)

(get-process).count
133

(get-process | select name -Unique).count
106

(get-process | select name | Get-Unique -AsString).count
106
Martin
  • 1,853
  • 3
  • 15
  • 22
0

Solved this by using Sort-Object | Get-Unique -AsString

| select -unique leaves only

Name                                                                                                                        
----                                                                                                                        
dnj-500.1    

Kinda strange, but Get-Unique result is fine.

Utka Kanibal
  • 31
  • 2
  • 10