Get all installed software on Windows 10 with Python 3 and WMI.

This is very basic and I’d lie if I said I hadn’t tried looping through the registry for 64/32 bit, but this works great and isn’t missing entries. I deliver this in a web page making it easy to do look ups on most machines in my org. Tweak as you need, add some error handling, but do not forget to enable WMI on the computers and create a service account to gain access. Also, install WMI via pip or whatever.

Web View Screenshot
Web View Screenshot

I actually check keys between product and miscellaneous to keep out dupes and add missing entries from product. It’s easier to keep everything in a single dictionary. On my web page I made the store entries an add-on to the data using a check box. You could likely just combine all three into a single dictionary if you prefer.

import wmi
#wmi_conn = wmi.WMI() for local.

def get_all_installed_win10_store(wkst):
    results = {}
    try:
        wmi_conn = wmi.WMI(wkst)
        for info in wmi_conn.Win32_InstalledStoreProgram():
            if '-' in info.Name: continue
            app_name = str(info.Name).encode('utf8','ignore').decode()
            if not info.Vendor:
                vender = 'None'
            if '-' in info.Vendor:
                vender = 'None'
            else:
                vendor = str(info.Vendor).encode('utf8','ignore').decode()
                vender = vendor.split(',')[0].split('=')[-1].strip()
            if app_name in results: continue
            if app_name not in results:
                results[app_name]=[]
               
            results[app_name]=[vender, info.Version, 'None']
    except:
        pass # Handle errors here
    return results
 
def get_installed_product_software(wkst):
    results = {}
    try:
        wmi_conn = wmi.WMI(wkst.lower())
        for info in wmi_conn.Win32_Product():
            app_name = str(info.Name).encode('utf8','ignore').decode()
            vendor = str(info.Vendor).encode('utf8','ignore').decode()
            if app_name not in results:
                results[app_name]=[]
            results[app_name]=[vendor, info.Version, info.InstallDate]
    except:
        pass
    return results
 
def get_all_installed_win10_software(wkst):
    results = {}
    try:
        wmi_conn = wmi.WMI(wkst)
        for info in wmi_conn.Win32_InstalledWin32Program():
            app_name = str(info.Name).encode('utf8','ignore').decode()
            vendor = str(info.Vendor).encode('utf8','ignore').decode()
            if app_name not in results:
                results[app_name]=[]
            results[app_name]=[vendor, info.Version, 'None']
    except:
        pass
    return results