Merge output of two commands

Hello All,

I am trying to retrieve the data of installed applications of both 32 and 64 bit by merging the output of two commands.

I am getting a space in between the output, can someone let me know the right way to do it.

$a  =@()
$a+= Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |select displayname, publisher|sort Displayname
$a+=Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*|select displayname, publisher|sort Displayname
$a

You’re overcomplicating this.

$PathList = 
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

Get-ItemProperty -Path $PathList | 
    Select-Object -Property displayname, publisher |
        Sort-Object -Property Displayname

I’d like to recommend to read the

2 Likes

Thanks much @Olaf

I am going through recommended link, it helps a lot!