Category filter

Scripts to Uninstall Enterprise apps on Windows

Administrators might have to remove custom apps once their purpose is served or if they become outdated. They can deploy scripts via Hexnode to uninstall such enterprise apps.

Disclaimer:

The Sample Scripts provided below are adapted from third-party Open-Source sites.

Batch Script

To uninstall .msi and .exe files,

E.g., To remove the enterprise app 7-Zip,

wmic product where "name like “’7%%'" call uninstall/nointeractive

Powershell Script

To uninstall .msi and .exe files,

E.g., To remove the enterprise app 7-Zip,


$app=Get-WmiObject –Class Win32_Product –Filter “Name like ‘%7%’”
$app.Uninstall()

Notes:

  • msiexec can also be used to uninstall msi files.
  • Some apps have custom executable files (.exe file) that uninstall the apps. Such apps might not get uninstalled using these commands. To uninstall such apps using scripts, you might have to use their UninstallString.
    E.g., To uninstall Firefox, run a batch script with the UninstallString along with the parameter /S for silent uninstallation.
    “C:\Program Files\Mozilla Firefox\uninstall\helper.exe” /S
  • To uninstall APPX/MSIX bundles use the Get-AppxPackage command of powershell.
  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository