Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created November 30, 2009 05:03
Show Gist options
  • Save bulkan/245264 to your computer and use it in GitHub Desktop.
Save bulkan/245264 to your computer and use it in GitHub Desktop.
import registry
def findUninstallStr(q):
''' q: some unique string that appears in the UninstallString value '''
uninstallKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
for subkey in registry.GetSubKeys(uninstallKey):
for (valuename, value, valuetype) in registry.GetKeyValues("%s\%s" %(uninstallKey, subkey)):
if 'UninstallString' == unicode(valuename) and q in unicode(value):
uninstallString = value
return r"%s" %unicode(uninstallString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment