{"id":25416384,"url":"https://github.com/forderud/msiquery","last_synced_at":"2025-08-10T11:14:19.622Z","repository":{"id":115293401,"uuid":"293335910","full_name":"forderud/MsiQuery","owner":"forderud","description":"Tools for querying MSI files and installed Windows apps","archived":false,"fork":false,"pushed_at":"2025-05-31T14:49:42.000Z","size":104,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T02:47:29.248Z","etag":null,"topics":["msi","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forderud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-06T18:15:13.000Z","updated_at":"2025-05-31T14:45:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"d370f357-f3ea-4f7b-a34f-3740a1d5e452","html_url":"https://github.com/forderud/MsiQuery","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/forderud/MsiQuery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FMsiQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FMsiQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FMsiQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FMsiQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forderud","download_url":"https://codeload.github.com/forderud/MsiQuery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forderud%2FMsiQuery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269713884,"owners_count":24463244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["msi","windows"],"created_at":"2025-02-16T16:54:53.435Z","updated_at":"2025-08-10T11:14:19.612Z","avatar_url":"https://github.com/forderud.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Standard metadata and installation practices involved in application \u0026 OS-updates on Windows computers. Other operating systems have similar but different metadata and practices.\n\n## Application packages\n\nOverview of categories of SW installers supported by Windows:\n| Category | Installation process | Installer metadata | Detection and uninstallation |\n|----------|----------------------|--------------------|------------------------------|\n| Executable (or script) | App-specific (command-line arguments and return codes not standardized) | In general not parseable, since the installer is a black-box that Windows doesn't understand | Standard registry location |\n| MSI      | Standardized (using `msiexec`) | Contains metadata that can be parsed. The installation steps can also be statically analyzed to asses security risk| MSI APIs or standard registry location |\n| MSIX     | Standardized (using APIs) | Contains metadata that can be parsed. The installation steps can also be statically analyzed to asses security risk | `Get-AppxPackage` |\n\n**Package identifier**: `ProductCode` (128bit unique GUID for MSI), `PackageFullName` string (for MSIX) or similar. All SW applications that show up in the Windows control panel for uninstallation does have a unique identifier.\n\nThe source of truth for installed EXE and MSI apps are the `HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{ProductCode}` registry folders.\n\n## Windows Installer packages (MSI files)\n**Format**: MSI (self-described format with metadata). Primarily designed for application SW, but drivers and system configuration can also be MSI-packaged for unified installation.\n\nCommon operations:\n| Operation | Description |\n|-----------|-------------|\n| Install | `msiexec.exe /i \u003cappname\u003e.msi /qn` (background installation) |\n| Uninstall | Command in `HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{ProductCode}\\UninstallString` registry key (`msiexec /x \"{ProductCode}\" /qn` for MSI apps)|\n| Upgrade | `msiexec.exe /i \u003cappname\u003e.msi /qn` (will automatically uninstall the old version before installing the new version and perform migration steps) |\n| Downgrade | Achieved through _uninstall_ followed by _install_ of the old version. |\n| Identify ProductCode | Check MsiQuery for code sample. |\n| Check if installed | Check MsiQuery for code sample. |\n\n### MsiQuery tool\nCommand-line tool for querying MSI files and installed Windows apps\n\nUsage: `MsiQuery.exe [*|\u003cfilename.msi\u003e|{ProductCode}|{UpgradeCode}]` where `*` will list all installed products.\n\nThe following is listed for each product:\n* [**PackageCode**](https://learn.microsoft.com/en-us/windows/win32/msi/package-codes): Unique identifier for a MSI installer file that _might_ contain multiple products.\n* [**ProductCode**](https://docs.microsoft.com/en-us/windows/win32/msi/productcode): Unique identifier for a particular product release. Must be changed as part of a [major version upgrade](https://learn.microsoft.com/en-us/windows/win32/msi/major-upgrades) but can be kept unchanged for [small updates](https://learn.microsoft.com/en-us/windows/win32/msi/small-updates)\n* [**UpgradeCode**](https://docs.microsoft.com/en-us/windows/win32/msi/using-an-upgradecode) (if present): Product identifier that remain unchanged across major version changes.\n* [ProductName](https://docs.microsoft.com/en-us/windows/win32/msi/productname)\n* [ProductVersion](https://docs.microsoft.com/en-us/windows/win32/msi/productversion)\n* [Manufacturer](https://docs.microsoft.com/en-us/windows/win32/msi/manufacturer)\n* Product [features](https://learn.microsoft.com/en-us/windows/win32/msi/windows-installer-features) and feature [installation status](https://learn.microsoft.com/en-us/windows/win32/msi/feature-table)\n\nThe following details are also listed:\n* [Custom Actions](https://docs.microsoft.com/en-us/windows/win32/msi/custom-actions) that might affect [system state](https://docs.microsoft.com/en-us/windows/win32/msi/changing-the-system-state-using-a-custom-action)\n* Path to installed EXE \u0026 DLL files (based on [File table](https://docs.microsoft.com/en-us/windows/win32/msi/file-table) query with [MsiGetComponentPath](https://docs.microsoft.com/en-us/windows/win32/api/msi/nf-msi-msigetcomponentpathw) lookup) (only for installed apps)\n* Added [registry entries](https://docs.microsoft.com/en-us/windows/win32/msi/registry-table) (can also be created through custom actions)\n\n### DetectInstalledApps script\nThe [DetectInstalledApps.ps1](./DetectInstalledApps.ps1) script can be used to detect installed EXE and MSI applications through a [registry scan](https://learn.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key).\n\nIt's possible to use the `Get-WmiObject Win32_Product` command to list all MSI-installed apps with ProductCode on the system. However, this listing will not include EXE-installed apps without a ProductCode, like 7-zip and Notepad++. It's therefore insufficient if we also want to support non-MSI installers.\n\n### ParseMSI script\nThe [ParseMSI.ps1](./ParseMSI.ps1) script can be used to detect installed MSI applications through the [WindowsInstaller](https://learn.microsoft.com/en-us/windows/win32/msi/installer-object) COM interfaces.\n\n### ScheduleReboot Installer\nSample installer for testing of reboot handling. The installer always returns ERROR_SUCCESS_REBOOT_REQUIRED (3010) to indicate that a reboot is required to complete the install.\n\n## MSIX packages\nMicrosoft is recommending to migrate to the newer [MSIX](https://learn.microsoft.com/en-us/windows/msix/overview) installer format. However, it's more restrictive with limitations on inter-app communication. Also, tooling support is lagging behind - at least for Qt (see [How to package a Win32 desktop app in MSIX?](https://bugreports.qt.io/browse/QTBUG-97088)). Adoption can therefore be challenging.\n\n### MsixQuery tool\nThe MsixQuery tool can be used to detect installed MSIX apps.\n\n\n## Microsoft Update packages (MSU files)\nMSU files is a separate format used for distribution of Windows OS updates. They are technically archives that contain cabinet (CAB) files with updates together with XML and TXT metadata.\n\n[Description of the Windows Update Standalone Installer in Windows](https://support.microsoft.com/en-us/topic/description-of-the-windows-update-standalone-installer-in-windows-799ba3df-ec7e-b05e-ee13-1cdae8f23b19).\n\n\n### Sample scripts for OS version\nGet OS version:\n```\nPS \u003e Get-WmiObject Win32_OperatingSystem\n\nSystemDirectory : C:\\Windows\\system32\nOrganization    : \u003corg-name\u003e\nBuildNumber     : 19044\nRegisteredUser  : \u003cuser\u003e\nSerialNumber    : \u003cserial\u003e\nVersion         : 10.0.19044\n```\n\nGet list of installed hotfixes (KB's):\n```\nPS \u003e Get-HotFix\n\nSource        Description      HotFixID      InstalledBy          InstalledOn\n------        -----------      --------      -----------          -----------\nMYMACHINE     Update           KB5027122     NT AUTHORITY\\SYSTEM  2023-06-23 12:00:00 AM\nMYMACHINE     Update           KB5003791                          2021-10-06 12:00:00 AM\nMYMACHINE     Security Update  KB5012170     NT AUTHORITY\\SYSTEM  2022-12-14 12:00:00 AM\nMYMACHINE     Security Update  KB5028166     NT AUTHORITY\\SYSTEM  2023-07-28 12:00:00 AM\nMYMACHINE     Security Update  KB5014032     NT AUTHORITY\\SYSTEM  2022-11-11 12:00:00 AM\nMYMACHINE     Update           KB5016705     NT AUTHORITY\\SYSTEM  2022-11-11 12:00:00 AM\nMYMACHINE     Update           KB5018506     NT AUTHORITY\\SYSTEM  2022-11-21 12:00:00 AM\nMYMACHINE     Update           KB5020372     NT AUTHORITY\\SYSTEM  2022-12-21 12:00:00 AM\nMYMACHINE     Update           KB5022924     NT AUTHORITY\\SYSTEM  2023-03-23 12:00:00 AM\nMYMACHINE     Update           KB5023794     NT AUTHORITY\\SYSTEM  2023-04-21 12:00:00 AM\nMYMACHINE     Update           KB5025315     NT AUTHORITY\\SYSTEM  2023-05-18 12:00:00 AM\nMYMACHINE     Update           KB5026879     NT AUTHORITY\\SYSTEM  2023-06-23 12:00:00 AM\nMYMACHINE     Update           KB5028318     NT AUTHORITY\\SYSTEM  2023-07-20 12:00:00 AM\nMYMACHINE     Security Update  KB5005699                          2021-10-06 12:00:00 AM\n```\n\n\n## Return codes\nInstallers are using the following return-codes to signal installation result:\n\n| Code | Interpretation |\n|------|----------------|\n| 0    | Success (installation completed successfully) |\n| 1707 | Success (installation completed successfully) |\n| 3010 | Soft reboot (restart is required to complete the install) |\n| 1641 | Hard reboot (installer have initiated a restart) |\n| 1618 | Retry (another installation is already in progress) |\n|      | Other values are treated as failure |\n\nThe above codes are used by InTune and probably other MDM solutions to detect installation success/failure and retry or restart if needed afterwards. We should therefore do the same.\n\nThe codes are documented on [MsiExec.exe and InstMsi.exe error messages](https://learn.microsoft.com/en-us/windows/win32/msi/error-codes).\n\n\n## References\nRelated tools:\n* [Orca](https://docs.microsoft.com/en-us/windows/win32/msi/orca-exe) MSI viewer: Included with Windows 10 SDK. By default installed to `%ProgramFiles(x86)%\\Windows Kits\\10\\bin\\\u003cversion\u003e\\x86\\Orca-x86_en-us.msi`\n* [msitools](https://gitlab.gnome.org/GNOME/msitools) for building \u0026 inspecing MSI files on Linux/Mac.\n\nDocumentation:\n* [Windows Installer](https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforderud%2Fmsiquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforderud%2Fmsiquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforderud%2Fmsiquery/lists"}