I’m trying to get the list of installed applications on a machine into a Listbox and so far I have this:
function programsinstalled_current
{
$prog = get-wmiobject win32_product -computer summer -Property Name | select Name
foreach($program in $prog)
{
[Void]$program_list_current.items.add($program)
}
}
and it returns this in the list box:

My question is how do I get rid of the unwanted ‘@{name=’ at the start of each program name and the ‘}’ at the end of each name?
I’ve tried the below code with getting the AD groups of a machine into Listbox and it works fine, but the same syntax won’t work the get-wmiobject win32_product:
function fill_current_list
{
$processnames_t = (Get-ADComputer -Identity $current_hostname.text -Property MemberOf).MemberOf
foreach ($processname in $processnames_t)
{
[void]$AD_list_current.Items.Add($processname)
}
If possible, I’d rather not use -replace
Thanks
try: