0

I'm using the import-csv command to pull a load of values in to populate a combobox in a Powershell script with a form. All works nicely. However in the console it displays a count of the values going in - so it shows 0,1,2,3,4 and so on.

Is it possible to suppress this? I want to have the GUI/form run without any other windows showing.

This is the code I'm using for the import.

Import-Csv "C:\Scripts\ProjectManagers.csv" |
ForEach-Object {
    $ComboBoxProjectPM.Items.Add($_.ProjectManager)
}
Itchydon
  • 2,572
  • 6
  • 19
  • 33
chris
  • 1
  • 2
    Assign `$null` to the expression. You should also be able to `AddRange`. – Santiago Squarzon Apr 25 '22 at 14:21
  • What you are describing is a common problem with adding items to list and similar objects - here is another example: https://stackoverflow.com/q/56965649/4190564 There are multiple methods for silencing the output, but if you look at the following answer you can see that piping to out-null is slow and should be avoided: https://stackoverflow.com/a/5263780/4190564 – Darin Apr 25 '22 at 15:03

0 Answers0