Home > Programming > Uninstalling a Windows Application From Python

Uninstalling a Windows Application From Python

Ensure that you have the Python WMI module installed and then call WMI to uninstall your application.

import wmi

c = wmi.WMI()

print ("Searching for matching products...")
for product in c.Win32_Product(Name = "Product Name"):
  print ("Uninstalling" + product.Name + "...")
  result = product.Uninstall()

To list the products that Windows knows about:

import wmi

c = wmi.WMI()
for product in c.Win32_Product():
  print product.Name

Software that has not been installed using Windows Installer (eg. Nullsoft Installer) will not be accessible through WMI.

References:

Categories: Programming
  1. No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.