This PowerShell script is designed to uninstall any installed instances of the software from a Windows machine.
The script searches for all installed software that matches the name in the variable "softwareName" and uninstalls each instance found. It uses WMI (Windows Management Instrumentation) to query installed products and performs the uninstallation process.
- Open PowerShell with administrative privileges.
- Copy and paste the script into the PowerShell window or save it as a
.ps1file and run it.
# Define the name of the software to uninstall
$softwareName = "Acrobat"
# Get a list of installed software matching the name
$software = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*$softwareName*" }
# If software is found, uninstall each instance
if ($software)
{
foreach ($app in $software)
{
Write-Host "Uninstalling $($app.Name)..."
$app.Uninstall()
Write-Host "Uninstallation of $($app.Name) complete."
}
}
else
{
Write-Host "No instances of $softwareName found."
}