Skip to content

Instantly share code, notes, and snippets.

@psatler
Last active April 8, 2024 09:15
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psatler/010b26cd57e758278823d7027c40e2a6 to your computer and use it in GitHub Desktop.
Save psatler/010b26cd57e758278823d7027c40e2a6 to your computer and use it in GitHub Desktop.
List the installed programs on Windows

Using only the Windows cmd

  1. Open the command prompt of windows
  2. Type wmic
  3. On the wmic prompt type the output command followed by the path of the txt file and the command to list the programs. It is going to be like the following:
  • /output:C:\Users\<yourUser>\Documents\programsInstalled\listOfProgramsInstalledWin10.txt product get name,version
  1. Wait for the wmic prompt get back to you again and you'll know it has finished listing the files into the txt file

Python script to display the list of programs installed on windows

The solution below was gotten from this stackoverflow response.

import winreg

def foo(hive, flag):
    aReg = winreg.ConnectRegistry(None, hive)
    aKey = winreg.OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
                          0, winreg.KEY_READ | flag)

    count_subkey = winreg.QueryInfoKey(aKey)[0]

    software_list = []

    for i in range(count_subkey):
        software = {}
        try:
            asubkey_name = winreg.EnumKey(aKey, i)
            asubkey = winreg.OpenKey(aKey, asubkey_name)
            software['name'] = winreg.QueryValueEx(asubkey, "DisplayName")[0]

            try:
                software['version'] = winreg.QueryValueEx(asubkey, "DisplayVersion")[0]
            except EnvironmentError:
                software['version'] = 'undefined'
            try:
                software['publisher'] = winreg.QueryValueEx(asubkey, "Publisher")[0]
            except EnvironmentError:
                software['publisher'] = 'undefined'
            software_list.append(software)
        except EnvironmentError:
            continue

    return software_list

software_list = foo(winreg.HKEY_LOCAL_MACHINE, winreg.KEY_WOW64_32KEY) + foo(winreg.HKEY_LOCAL_MACHINE, winreg.KEY_WOW64_64KEY) + foo(winreg.HKEY_CURRENT_USER, 0)

for software in software_list:
    print('Name=%s, Version=%s, Publisher=%s' % (software['name'], software['version'], software['publisher']))
print('Number of installed apps: %s' % len(software_list))
@karanphol
Copy link

Thank you, how to deploy all computer or notebook in domain ?

@psatler
Copy link
Author

psatler commented Feb 15, 2022

@karanphol I'm not sure if I understood your question. Are you asking about how to reinstall all those those programs listed with the script above? If so, I haven't done that before on Windows, but on other OSs people usually make use of dotfiles to restore their system, like shown at this youtube video.

@sumeshir26
Copy link

Thanks for this script, is it possible to also get the path of the program's eexecutable?

@xtream-club
Copy link

Thanks for this script, is it possible to also get the path of the program's eexecutable?

pudiste?

@tute123456
Copy link

Thanks for this script, is it possible to also get the path of the program's eexecutable?

pudiste?

hola, tenes idea de algun script/comando/soft, que te haga una comprobacion de los soft instalados, y que compruebe si tenes la ultima version y lo actualice de forma automatica? el unico script que conozco es winget upgrade --all --include-unknown , pero a veces no reconoce que tenes la ultima version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment