I’m trying to uninstall a software on a remote computer by IP. I know the software is installed on the computer but the script keeps returning Software not found. I looked in the registry to see if the name was different from what was in control panel and the name matches unsure what I’m doing wrong.
$computerName = "*****"
$softwareName = "Epic Satellite"
$credential = Get-Credential
$software = Get-WmiObject -Class Win32_Product -ComputerName $computerName -Credential $credential | Where-Object { $_.Name -eq $softwareName }
if ($software) {
$software.Uninstall()
Write-Host "Software '$softwareName' uninstalled successfully from '$computerName'."
} else {
Write-Host "Software '$softwareName' not found on '$computerName'."
}
Looks like you’re looking for an exact match on the name. Are you sure that’s what is returned by the Get-WmiObject cmdlet? Could be a version tackled on. Also is the software installed as User or System? Those won’t show up in the same place.
I’m still very new to PowerShell but this is what I’m trying to uninstall on the remote computer and where its held in the registry. The Software is installed on the system and not user based.
when I run get the get command It returns the right name that I need as shown in the picture below. When I try to use the uninstall sting with that display name to get the reg uninstall file it does nothing. Im very confused on what is happening. I am useing my computer as a test to get it to uninstall locally then ill move it to the remote script.
This is the script I ran just to see if I can get the uninstall link from PowerShell and it returns nothing but as you can see from my original post the software is in my registry