Script is to search a computer with a specific name to the specified .exe or .msi file/application. To my knowledge the commented out .msi line works, but the .exe line does not. In this example I am trying to find "Firefox". If the file/application is found it should display the Version. If the file/application is not found it should display "does not have this application."
If you can fix it PLEASE fix my code and post it.
$ADObjects = Get-ADComputer -filter {(name -like "PC Name goes here")};
$ADObjects | ForEach {
    $computerName = $_.name;
    Write-Output $computerName;
    #$Versions = (Get-WmiObject -Class Win32_Product -ComputerName $computerName| Where-Object {$_.name -like "FireFox"});   # Finds .msi programs
    $Versions = (ComputerName $computerName| Where-Object { $_.Name -Like 'Firefox*' }); # Trying to find .exe programs
    $Count = ($Versions | Measure-object).count;
    if ($Count -eq 0) {
        Write-Output "$computerName does not have this application.";
    }
    else {
    
        Write-Output $Versions;
        #$Versions.unistall();    # Uncommenting this line will uninstall the versions listed by the line above
    }
}
