Within PowerShell, this is very easy to do.

The below block of script will take a computer name, your username and password, connect to the remote computer and list all installed software by name:

$computerName = "SomeComputerName"
$yourAccount = Get-Credential
Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
    Get-WmiObject Win32_Product | Select Name
}

When you have the name of the product you want to uninstall remotely - you can the perform an uninstall like this:

$computerName = "SomeComputerName"
$appName = "AppName"
$yourAccount = Get-Credential
Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
    Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {
        $_.Uninstall()
    }
}

In the above eaxmples - replace "SomeComputerName" with the name of the computer you wish to uninstall from.

You can also make the script prompt you for a computer name if you prefer with the following line:

$computerName = Read-Host "Enter Computer Name"

If you have multiple computers with the same piece of software that you want to uninstall - you can also define an array of computers to work with and do uninstalls from lots of machines:

$computerNames = @("SomeComputerName1", "SomeComputerName2", "SomeComputerName3")
$appName = "AppName"
$yourAccount = Get-Credential
ForEach ($computerName in $computerNames) {
    Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
        Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {
            $_.Uninstall()
        }
    }
}
Answer from Fazer87 on Stack Exchange
Top answer
1 of 2
2

Within PowerShell, this is very easy to do.

The below block of script will take a computer name, your username and password, connect to the remote computer and list all installed software by name:

$computerName = "SomeComputerName"
$yourAccount = Get-Credential
Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
    Get-WmiObject Win32_Product | Select Name
}

When you have the name of the product you want to uninstall remotely - you can the perform an uninstall like this:

$computerName = "SomeComputerName"
$appName = "AppName"
$yourAccount = Get-Credential
Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
    Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {
        $_.Uninstall()
    }
}

In the above eaxmples - replace "SomeComputerName" with the name of the computer you wish to uninstall from.

You can also make the script prompt you for a computer name if you prefer with the following line:

$computerName = Read-Host "Enter Computer Name"

If you have multiple computers with the same piece of software that you want to uninstall - you can also define an array of computers to work with and do uninstalls from lots of machines:

$computerNames = @("SomeComputerName1", "SomeComputerName2", "SomeComputerName3")
$appName = "AppName"
$yourAccount = Get-Credential
ForEach ($computerName in $computerNames) {
    Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
        Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {
            $_.Uninstall()
        }
    }
}
2 of 2
0

If you create a file called "servers.txt" and place your list of servers in it you could also reference $computerNames as follows:

$computerNames = Get-Content "C:\some-directory\servers.txt"
$appName = "AppName"
$yourAccount = Get-Credential
ForEach ($computerName in $computerNames) {
    Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {
        Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {
            $_.Uninstall()
        }
    }
}

I've used this approach many times in production environments and it seems to work for me. Always test this in a non-production environment before completing in a prod environment.

🌐
Reddit
reddit.com › r/powershell › uninstall remotely
r/PowerShell on Reddit: Uninstall remotely
January 21, 2020 -

So I’m having trouble uninstalling software through powershell. I am an admin and I can uninstall software that has an uninstall string that’s similar to {numbers letters}

But when I try to uninstall software that’s uninstall string is a folder in program files (x86). It won’t work. Here is my script:

$computername = name $number = identifying number $software = get-wmiobject win32_product -Computer name $computername | where-object {$_.IdentifyingNumber -eq $Number} If ($software){ $software.uninstall () }else{ $Number + ‘is not installed on’ + $computername

How can I change this to use the software without the identifying number?

Discussions

Uninstall Application from Remote PC with Powershell Invoke Command - Programming & Development - Spiceworks Community
Hi, After some ideas please, not sure what i am doing wrong, the script doesnt prompt any errors, just simply doenst do the Uninstall either - I have confirmed with the vendor that the Uninstallforce switch is correct, Any suggestions what i am missing? $adminCreds = Get-Credential -UserName ... More on community.spiceworks.com
🌐 community.spiceworks.com
4
February 10, 2022
Uninstalling a remote application not working
Hi, Guys. I’m having trouble getting a remote application to uninstall from a server. I’ve looked at a couple different ways of doing this, but I don’t want to use Win32_Product. Which leaves me with the Get-Package and Uninstall-Package cmdlet’s. Neither of which work. More on forums.powershell.org
🌐 forums.powershell.org
0
0
March 8, 2024
Uninstall Software Remote Powershell Script - Stack Overflow
I'm trying to uninstall a software on a remote computer by IP. I know the software is installed on the computer by the script keeps returning Software not found. I looked in the registry to see if ... More on stackoverflow.com
🌐 stackoverflow.com
Powershell Script to Uninstall Applications Remotely - Programming & Development - Spiceworks Community
I am attempting to write a script to uninstall Citrix Receiver remotely. I have done a bunch of digging and have come up with this pretty simple script: $app = Get-WmiObject Win32_Product -ComputerName "SOME COMPUTER" |… More on community.spiceworks.com
🌐 community.spiceworks.com
11
July 20, 2015
🌐
Microsoft
devblogs.microsoft.com › dev blogs › scripting blog [archived] › use powershell to find and uninstall software
Use PowerShell to Find and Uninstall Software - Scripting Blog [archived]
December 14, 2011 - Summary: Learn how to use Windows PowerShell to get software installation locations, and to uninstall software from remote computers. Hey, Scripting Guy! We have a dumb application that we have to use at work. The company has released a new version of this application, and I am trying to write ...
🌐
Spiceworks
community.spiceworks.com › programming & development
Uninstall Application from Remote PC with Powershell Invoke Command - Programming & Development - Spiceworks Community
February 10, 2022 - Hi, After some ideas please, not sure what i am doing wrong, the script doesnt prompt any errors, just simply doenst do the Uninstall either - I have confirmed with the vendor that the Uninstallforce switch is correct, Any suggestions what i am missing? $adminCreds = Get-Credential -UserName "DomainAD\myadminacc" -Message "Enter Domain Admin Credentials" $PCName = Read-Host "Please enter the Remote Office PC Name" $UninstallPath = "C:\Program Files (x86)\ThomsonReuters\Eikon\Eikon.exe -unin...
🌐
4sysops
4sysops.com › home › blog › articles › uninstall programs (remotely) with powershell
Uninstall programs (remotely) with PowerShell – 4sysops
July 28, 2023 - With its help, you can first view the installed software: Get-CimInstance -Class Win32_Product -ComputerName <Remote-PC> | -Format-List · Once you have viewed the program in question, you can further narrow the list: Get-CimInstance -Class Win32_Product -ComputerName <Remote-PC> | where name -like " PowerShell*" If you send the output of this command through a pipe to Get-Member, you will not find an uninstall method.
🌐
PowerShell Forums
forums.powershell.org › powershell help
Uninstalling a remote application not working - PowerShell Help - PowerShell Forums
March 8, 2024 - Hi, Guys. I’m having trouble getting a remote application to uninstall from a server. I’ve looked at a couple different ways of doing this, but I don’t want to use Win32_Product. Which leaves me with the Get-Package and…
Find elsewhere
🌐
Redmondmag.com
redmondmag.com › articles › 2019 › 08 › 27 › powershell-to-uninstall-an-application.aspx
How To Use PowerShell To Uninstall an Application -- Redmondmag.com
August 27, 2019 - Now you can uninstall the application by calling the Uninstall method. Here is the command: ... The technique that I just showed you is the generally accepted way of removing applications from a Windows desktop using PowerShell.
🌐
Stack Overflow
stackoverflow.com › questions › 77860416 › uninstall-software-remote-powershell-script
Uninstall Software Remote Powershell Script - Stack Overflow
$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'." } ... Is dcom on the remote computer working? I would do it in remote powershell with uninstall-package.
🌐
Spiceworks
community.spiceworks.com › programming & development
Powershell Script to Uninstall Applications Remotely - Programming & Development - Spiceworks Community
July 20, 2015 - I am attempting to write a script to uninstall Citrix Receiver remotely. I have done a bunch of digging and have come up with this pretty simple script: $app = Get-WmiObject Win32_Product -ComputerName "SOME COMPUTER" | where { $_.name -eq "Citrix Receiver Updater" } $app.Uninstall() When I run the command locally I have zero problems.
🌐
Reddit
reddit.com › r/powershell › powershell command/script to uninstall software on a remote machine
r/PowerShell on Reddit: Powershell Command/Script to Uninstall Software on a Remote Machine
February 14, 2018 -

I have been working this for a couple days now, and no matter how I run this and work it, it seems to uninstall the program via PowerShell and returns the success code:

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 0
PSComputerName   :

This happens with various notoriously difficult to remove software such as McAfee.

The command being used is:

 Get-WmiObject -Class win32_product -Filter "Name like '%McAfee%'" | ForEach-Object {$_.Uninstall()}

I've tried various scripts, solutions on StackOverflow, and variations and nothing works.

🌐
Action1
action1.com › home › blog › how to uninstall software using powershell in windows 10
How to Uninstall Software via Powershell in Windows 10
September 19, 2025 - Note: PowerShell is fascinating because it allows you to, for example, remotely uninstall software with PowerShell from the Microsoft store. In fact, this is the only way to remove such programs.
🌐
KC's Blog
kjctech.net › home › microsoft › remotely uninstalling a program using powershell
Remotely Uninstalling A Program Using PowerShell | KC's Blog
March 15, 2024 - The drawback is that you would need to use the Invoke-Command cmdlet to execute it on a remote computer. Invoke-Command -ComputerName $computername -Scriptblock {Get-Package -Name 'Kofax*' | Uninstall-Package · Group Policy to Bypass the UAC Prompt After PrinterNightmare Patch · Managing Microsoft Licenses in PowerShell and Microsoft Graph
Top answer
1 of 4
7

Hi there,

I’m trying to put together a Powershell GUI script for uninstalling software on network computers remotely using WMI. The form stuff seems to be OK, the buttons are generating properly, but I’m having a hard time kicking off the function. The idea is that it passes the name of the button over to:

Get-WmiObject Win32_Product -ComputerName $ComputerName | Where-Object{$_.name -match *name on button* } | ForEach-Object{$_.Uninstall()}

It doesn’t seem to do it though, I’m pretty sure the value is ending up being null. I guess the best way to do this would be to have the button called the software name and have the button click pass the software’s IdentifyingNumber to the command, but I can’t figure out how to do that either.

Here’s what I have so far:

$ComputerName = $env:computername #Temporarily using my computer for testing
$form = New-Object System.Windows.Forms.Form
$Software = Get-WmiObject Win32_Product -ComputerName $computername | Select Name | Sort-Object -property name #Get list of apps and alphabetise them
$Form_i=0
$App_to_remove = $null #Make sure button variable starts empty

foreach ($App in $Software){
    if ($App.Name -ne $null){ #Weed out the empty buttons
        $AppButton = New-Object System.Windows.Forms.Button
        $AppButton.Name = $App.name
        $AppButton.location = "10,$(25*++$Form_i)"
        $AppButton.size = '400,20'
        $AppButton.Text = $App.name
        # Add Click Event
        $AppButton.add_click({
        $App_to_remove = $this.Content.trim()
        Get-WmiObject Win32_Product -ComputerName $ComputerName | Where-Object{$_.name -match $App_to_remove } | ForEach-Object{$_.Uninstall()}
        })

        $form.controls.add($AppButton)
        }
    }

#Stuff to format the form
$form.HorizontalScroll.Maximum = 0
$form.AutoScroll               = $false
$form.VerticalScroll.Visible   = $false
$form.AutoScroll               = $true
$Form.minimumSize               = New-Object System.Drawing.Size(450,500)
$Form.maximumSize               = New-Object System.Drawing.Size(450,500)
$Form.Text                     = "Uninstall Apps"
$Form.ShowIcon                 = $False
$form.showdialog()

I think I need to build a function for the click, but I can’t figure out how to pass information from the button to the function, whether it be the preferred IdentifyingNumber or just simply the name on the button.

Any advice on how to get this working would be appreciated.

Cheers.

2 of 4
0
> VihaanReyansh:

Make it work first, then worry about GUI… PowerShell is not super for GUI stuff…

🌐
NinjaOne
ninjaone.com › home › blog › software deployment › 4 ways to remotely uninstall software (and keep it uninstalled with automation)
How to Remotely Uninstall Software with NinjaOne | NinjaOne
April 29, 2025 - While the other methods mentioned above are also incredibly effective, only through IT automation can you uninstall programs remotely and ensure they stay unavailable to end-users. This final option for automating your uninstaller can save MSPs a lot of time and other critical resources. Effectively leveraging automation for software removal requires two steps in NinjaOne: ... You can create an uninstall script using one of the languages NinjaOne supports for scripting, such as Batch or PowerShell.
🌐
Windows OS Hub
woshub.com › uninstall-apps-with-powershell-windows
Uninstalling Apps Using PowerShell or CMD on Windows 11 and 10 | Windows OS Hub
1 week ago - For example, to uninstall Microsoft ... command is not supported in newer versions of PowerShell Core. Instead, use the Get-CimInstance cmdlet. List the installed software......
🌐
PowerShell Forums
forums.powershell.org › powershell help
Uninstall software remotely - PowerShell Help - PowerShell Forums
May 31, 2018 - I have tried the following: $app = Get-WmiObject Win32_Product -computername "PC1" | where { $_.name -eq "softwarename" } $app.Uninstall() –And Also– $application = Get-WmiObject Win32_Product -filter "Name='softwarename'" -ComputerName ...
🌐
AirDroid
airdroid.com › home › remote support › how to uninstall software remotely on windows
How to Uninstall Software Remotely on Windows – AirDroid
July 12, 2024 - Invoke-WmiMethod -Class Win32_Product -Name Uninstall -ArgumentList $null -ComputerName "RemoteComputerName" -Filter "Name='ProgramName'" Step 4. Creating PowerShell scripts enhances automation and scalability: $computers = Get-Content "C:\computerlist.txt" $programName = "Software to Uninstall" foreach ($computer in $computers) { Invoke-Command -ComputerName $computer -ScriptBlock { $program = Get-WmiObject -Class Win32_Product -Filter "Name='$using:programName'" if ($program) { $program.Uninstall() Write-Host "$using:programName uninstalled from $env:COMPUTERNAME" } } }
🌐
Steemit
steemit.com › dtube › @askjoyb › 0gr66mhq
Powershell Script to uninstall software on Remote Computer [AskJoyB] — Steemit
August 28, 2017 - $app = Get-WmiObject Win32_Product -ComputerName "SOME COMPUTER" | where { $_.name -eq "Citrix Receiver Updater" } $app.Uninstall()
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › packagemanagement › uninstall-package
Uninstall-Package (PackageManagement) - PowerShell | Microsoft Learn
The Uninstall-Package cmdlet uninstalls one or more software packages from the local computer. To find installed packages, use the Get-Package cmdlet. Important The commands contained in the PackageManagement module are different than the commands ...
Top answer
1 of 3
2

Here's another approach, using Schedule Tasks.

Create a task locally using the logged-on user credentials, you must have admin rights on the remote computer of course.

Function Run-RemoteCommand
{

Param(

[Parameter(Mandatory = $true)]
[String]
$Computer,

[Parameter(Mandatory = $true)]
[String]
$Task,

[Switch]
$Background

)

$TaskName = "TempTask"
$Explorer=gwmi win32_process -ComputerName $Computer | ? {$_.ProcessName -eq "explorer.exe" }
$OWner = $Explorer.GetOwner().Domain + "\" + $Explorer.GetOwner().User
if ($Background)
{
$Create = "SCHTASKS /Create /TN ""$TaskName"" /RU System /TR ""$Task"" /SC Once /ST 22:30"
}
Else
{
$Create = "SCHTASKS /Create /TN ""$TaskName"" /RU $Owner /TR ""$Task"" /SC Once /ST 22:30"
}
$Runit = "SCHTASKS /Run /TN ""$TaskName"""
$Delete = "SCHTASKS /Delete /TN ""$TaskName"" /F"
$WMI = Get-WmiObject -List Win32_Process -ComputerName $Computer 
$WMI.Create($Create)
$WMI.Create($Runit)
Sleep 2
$WMI.Create($Delete)
}

To Run it:

Run-RemoteCommand -Computer "192.xxx.xxx.xxx" -Task 'c:\path\uninstall.exe /S'

if you want to run it as 'NT AUTHORITY\SYSTEM' add the -Background Switch

2 of 3
0

The best way would be to always have the local shell run as an elevated user. This allows you to start invoke-command without providing credentials in a script.

Once you have a Powershell running as an administrative user, and you can run your script using invoke-command. I do it all the time.

If you are scheduling this task, you will have to have the task run as the elevated user. This again, stops you from having to put the password in plain text in the script.