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:
- http://www.velocityreviews.com/forums/t369110-re-accessing-add-remove-programs-details.html
- http://timgolden.me.uk/python/wmi/index.html
- http://msdn.microsoft.com/en-us/library/aa393941(v=VS.85).aspx
Categories: Programming