Zend certified PHP/Magento developer

Determining Software that is Already Installed

I am looking for a way to figure out how to determine if a software application is already installed. I saw some ways people have done it for Software Dependencies but that does not quite do what I need. I am using the Get-WmiObject in Powershell. Here is my code so far:

#Check for Sophos
$MyApp = Get-WmiObject -Class Win32_Product | sort-object Name | select Name | where { $_.Name -eq "Sophos Endpoint"}

#Logic To Install or Skip
if ($MyApp -eq "Sophos Endpoint"){
    Write-Output "Sophos Endpoint is already installed on this computer."
}
else{
    Write-Output "Sophos Endpoint will be installed quietly in the background"

    #Install Sophos
    SophosSetup.exe --products=antivirus,intercept --quiet
}

I believe I have a formatting Issue which is why my if else statement is not working properly.