Software wont Uninstall with Remote Powershell Script

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'."
}

image

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

$uninstallString = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -eq "Epic Satellite" }).UninstallString

Might be some funky chars in that string like extra space at the end??
What happens if you try:

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -match "Epic Satellite" }
1 Like

Ok that works and it outputs the picture below. Will I just not take that prompt and replace it with the following code in the original post?

$software = Get-WmiObject -Class Win32_Product -ComputerName $computerName -Credential $credential | Where-Object { $_.Name -eq $softwareName }

Try changing to (neemoBeer suggested the same):

Where-Object { $_.Name -Match $softwareName }

Yeah I’m not sure what is happening I’m going to assume it is not possible with this software.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.