I am trying to filter the results of the following command to only return the UninstallString of a specific piece of software on a remote computer. The command runs without an issue, but it returns the UninstallString of all programs installed on the remote computer. If I run the same command on my local machine without the "Invoke-Command -ComputerName $computer -ScriptBlock", it works properly and filters the results as needed. Any help is greatly appreciated!
$computer="Test1"
$softwareName="Solarwinds"
$uninstall32=Invoke-Command -ComputerName $computer -ScriptBlock {Get-ChildItem "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" | Get-ItemProperty | Where-Object {$_.DisplayName -like "*$softwareName*"} | Select UninstallString}