# Output in Listbox is incomplete in powershell GUI

**URL:** <https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601>\
**Category:** PowerShell Help\
**Created:** [November 27, 2016, 4:29pm UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601 "2016-11-27T16:29:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [November 27, 2016, 4:29pm UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/1 "2016-11-27T16:29:06Z")

</div>

Hi, when I try to output the edmpolicy property from a AD Group the output is incomplete in a listbox. It should look like this {+SOFTWARE/75\_MS\_VS\_CPLUSPLUS\_2K8\_SP1, +SOFTWARE/APP50\_VMWAREPLUGIN6\_041416} but it only shows +SOFTWARE/APP50\_VMWAREPLUGIN6\_041416. Is it some formatting I’m missing? Is it possible to remove the +SOFTWARE/ output also? Thanks for any help in advance.

```
$buttonViewZService_Click= {
	#TODO: Place custom script here
	
	$vbmsg = new-object -comobject wscript.shell
	if ($list2.selecteditems.count -gt 1) { $vbmsg1 = $vbmsg.popup("You may only select one Group at a time.", 0, "Error", 0) }
	elseif ($list2.selecteditems.count -lt 1) { $vbmsg1 = $vbmsg.popup("Please select an Group to view.", 0, "Error", 0) }
	else
	{
		
		$exprString = '$list2.SelectedItems | foreach-object {$_.tag} | foreach-object {$_.name}'
		$endapp = invoke-expression $exprString
		import-module activedirectory
			
		
		$list1.visible = $true
		$columnnames = "Name", "Path"
		$list1.Columns[1].text = "Install Date"
		$list1.Columns[1].width = 129
		$list1.Columns[0].text = "Name"
		$list1.Columns[0].width = ($list1.width - $list1.columns[1].width - 25)
		
		$list1.items.Clear()
		$systeminfoerror = $null
		import-module activedirectory
		
		$software = Get-ADgroup -LDAPFilter "(&(Name=$endapp))" -Property *
				
		$columnproperties = "Name"
		foreach ($app in $software)
		{
			$item = new-object System.Windows.Forms.ListViewItem($app.edmPolicy)
			if ($app.InstallDate -ne $null)
			{
				$item.SubItems.Add($app.Result)
			}
			$item.Tag = $app
			$list1.Items.Add($item) > $null
		}
	}
}
```

---

<div class="post-metadata">

**Author:** ![matt-howard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/matt-howard/32/247_2.png) [@matt-howard](https://forums.powershell.org/u/matt-howard)\
**Post date:** [November 27, 2016, 6:22pm UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/2 "2016-11-27T18:22:18Z")

</div>

It looks like the edmpolicy attribute is an array. You will probably have to do a foreach loop for $app.edmpolicy and put your code for adding to the list in that foreach loop.

---

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [November 27, 2016, 7:54pm UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/3 "2016-11-27T19:54:43Z")

</div>

Hi, could you please give me an example? Sorry I’ve been struggling with this all weekend. Is there also a way to remove the +SOFTWARE/ from the output also? Thanks for your help.

---

<div class="post-metadata">

**Author:** ![matt-howard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/matt-howard/32/247_2.png) [@matt-howard](https://forums.powershell.org/u/matt-howard)\
**Post date:** [November 28, 2016, 2:00am UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/4 "2016-11-28T02:00:36Z")

</div>

Sure thing. I’ll modify the section of your code that it would go into:

```
foreach ($app in $software) {
    # Process each item in the edmPolicy array and remove the leading text, then add to the list
    foreach ($policy in $app.edmPolicy) {
        $PolicyName = $policy -replace "\+SOFTWARE\/"
        $item = new-object System.Windows.Forms.ListViewItem($PolicyName)
        if ($app.InstallDate -ne $null) {
            $item.SubItems.Add($app.Result)
        }
        $item.Tag = $app
        $list1.Items.Add($item) > $null
    }
}
```

Let me know if that works for you.

---

<div class="post-metadata">

**Author:** ![tony-rodal](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@tony-rodal](https://forums.powershell.org/u/tony-rodal)\
**Post date:** [November 28, 2016, 7:06am UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/5 "2016-11-28T07:06:35Z")

</div>

That works great Matt. Thanks for your help!! 🙂

---

<div class="post-metadata">

**Author:** ![matt-howard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/matt-howard/32/247_2.png) [@matt-howard](https://forums.powershell.org/u/matt-howard)\
**Post date:** [November 28, 2016, 10:32am UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/6 "2016-11-28T10:32:17Z")

</div>

Happy to help!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/output-in-listbox-is-incomplete-in-powershell-gui/7601/7 "2024-05-16T20:39:50Z")

</div>


