Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Using Listbox with a variable to inject item

$
0
0

I am trying to setup a selection list using $Listbox.Items.Add but I do not want to use static data but rather content from Get-DistributionGroup and have not figured out how to add the content yet. I tried piping to text file but it adds spaces to the DG name which breaks the search.

$listBox.SelectionMode = "Multiextended"

$FullDL = Get-DistributionGroup -anr "x-a" | Format-Table Name

Get-content $FullDL | ForEach-Object {[void] $ListBox.Items.Add($_)}

$form.Controls.Add($listBox)

$form.Topmost = $True

$result = $form.ShowDialog()

Any help would be much appreciated.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles