Also can be downloaded from: https://www.powershellgallery.com/packages/Get-WingetList
Get-WingetList.ps1 is a PowerShell script designed to list and manage installed packages using the Windows Package Manager (winget). It provides detailed information about installed packages from different sources (winget, msstore, and packages with no source), including their names, IDs, versions, and optionally VirusTotal links for winget packages. The script supports exporting reports in Markdown and HTML formats and can update a SHA256 cache for VirusTotal links.
This script is useful for system administrators, IT professionals, and users who want to audit installed software, check for updates, or generate reports about their system's package inventory.
- List Installed Packages: Displays all installed packages, grouped by source (
winget,msstore, and no source) and update status (updatable or not). - VirusTotal Integration: Optionally retrieves VirusTotal links for
wingetpackages based on their SHA256 hashes, with caching to improve performance. - Export Options: Generates reports in Markdown (
WingetListReport.md) or HTML (WingetListReport.html) formats for easy sharing or documentation. - Updateable Package Detection: Identifies packages with available updates and displays their current and available versions.
- SHA256 Cache Management: Maintains a local JSON cache (
wingetlist-sha-cache.json) to store SHA256 hashes and avoid redundant queries. - Command-Line Flexibility: Supports parameters for filtering, updating VirusTotal links, and exporting reports.
-
PowerShell Core 7.0 or higher: The script requires PowerShell Core (
#Requires -PSEdition Core -Version 7.0). -
Windows Package Manager (
winget): Thewinget.execommand-line tool must be installed. It is included with Windows 10 version 1809 or later or can be installed via the Microsoft Store. -
Microsoft.WinGet.Client PowerShell Module: The
Get-WinGetPackagecmdlet is required. Install it from the PowerShell Gallery using:Install-Module -Name Microsoft.WinGet.Client -RequiredVersion 1.10.340
-
Windows Operating System: The script is designed for Windows environments where
wingetis supported.
-
Download the Script:
-
Clone this repository or download the
Get-WingetList.ps1file:git clone https://github.com/bfcns/Get-WingetList.git
-
-
Place the Script:
- Save
Get-WingetList.ps1in a directory of your choice (e.g.,C:\Scripts).
- Save
-
Install Dependencies:
-
Ensure
winget.exeis available. Verify by running:winget --version -
Install the
Microsoft.WinGet.Clientmodule if not already installed:Install-Module -Name Microsoft.WinGet.Client -RequiredVersion 1.10.340
-
Run the script in PowerShell Core with the desired parameters. Below are the available parameters and examples.
| Parameter | Alias | Type | Description |
|---|---|---|---|
-Name |
String | Filter packages by name (optional). | |
-IncludeVirusTotalLink |
-i |
Switch | Include VirusTotal links for winget packages in the output. |
-UpdateVirusTotalLink |
-u |
Switch | Update the SHA256 cache and fetch VirusTotal links for winget packages. |
-ExportMarkdown |
-m |
Switch | Export the package list to a Markdown file (WingetListReport.md). |
-ExportHtml |
-h |
Switch | Export the package list to an HTML file (WingetListReport.html). |
-
List All Installed Packages: Display all installed packages grouped by source and update status:
.\Get-WingetList.ps1 -
Include VirusTotal Links: Display packages with VirusTotal links for
wingetpackages (uses cached SHA256 hashes):.\Get-WingetList.ps1 -IncludeVirusTotalLink
-
Update SHA256 Cache: Fetch and update SHA256 hashes for
wingetpackages and save towingetlist-sha-cache.json:.\Get-WingetList.ps1 -UpdateVirusTotalLink
-
Export to Markdown: Generate a Markdown report of all packages:
.\Get-WingetList.ps1 -ExportMarkdown
Output is saved to
WingetListReport.md. -
Export to HTML: Generate an HTML report of all packages:
.\Get-WingetList.ps1 -ExportHtml
Output is saved to
WingetListReport.html. -
Combine Options: List packages, include VirusTotal links, and export to both Markdown and HTML:
.\Get-WingetList.ps1 -IncludeVirusTotalLink -ExportMarkdown -ExportHtml
The script groups packages into six categories and displays them in the console:
- Winget Updateable Installed Packages:
wingetpackages with available updates. - Winget Installed Packages:
wingetpackages that are up-to-date. - Store Updateable Installed Packages: Microsoft Store (
msstore) packages with available updates. - Store Installed Packages:
msstorepackages that are up-to-date. - No Source Updateable Installed Packages: Packages with no source that have updates.
- No Source Installed Packages: Packages with no source that are up-to-date.
Each group is displayed as a table with columns for Name, Id, Version, and optionally New Version (for updateable packages) and VirusTotalLink (for winget packages when -IncludeVirusTotalLink or -UpdateVirusTotalLink is used).
When -ExportMarkdown is specified, the script generates a Markdown file with tables for each source:
- Winget Packages: Includes
Name,Version,Id, andVirusTotalLink(if enabled). - MSStore Packages: Includes
Name,Version, andId. - No Source Packages: Includes
Name,Version, andId.
Example Markdown output:
## Winget Packages
| Name | Version | Id | VirusTotalLink |
| ----------- | ------- | ----------- | --------------------------------------------- |
| Example App | 1.0.0 | Example.App | https://www.virustotal.com/gui/file/abc123... |
## MSStore Packages
| Name | Version | Id |
| --------- | ------- | ------------ |
| Store App | 1.2.3 | 9NBLGGH4NNS1 |
## No Source Packages
| Name | Version | Id |
| ----------- | ------- | ----------- |
| Unknown App | 1.0 | Unknown.App |When -ExportHtml is specified, the script generates an HTML file with tables for each source, styled with basic HTML formatting. VirusTotal links are rendered as clickable hyperlinks.
Example HTML output:
<h2>Winget Packages</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Version</th>
<th>Id</th>
<th>VirusTotalLink</th>
</tr>
<tr>
<td>Example App</td>
<td>1.0.0</td>
<td>Example.App</td>
<td>
<a href="https://www.virustotal.com/gui/file/abc123...">VirusTotal</a>
</td>
</tr>
</table>
<h2>MSStore Packages</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Version</th>
<th>Id</th>
</tr>
<tr>
<td>Store App</td>
<td>1.2.3</td>
<td>9NBLGGH4NNS1</td>
</tr>
</table>
<h2>No Source Packages</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Version</th>
<th>Id</th>
</tr>
<tr>
<td>Unknown App</td>
<td>1.0</td>
<td>Unknown.App</td>
</tr>
</table>When -UpdateVirusTotalLink is used, the script updates a JSON file (wingetlist-sha-cache.json) with SHA256 hashes for winget packages. The cache format is:
{
"Example.App": {
"Version": "1.0.0",
"SHA": "abc123..."
}
}- SHA256 Cache: The script stores SHA256 hashes in
wingetlist-sha-cache.jsonto avoid redundantwinget showcommands. Use-UpdateVirusTotalLinkto refresh the cache for new or updated packages. - VirusTotal Links: Links are only generated for
wingetpackages and require a valid SHA256 hash. If a hash is missing, the script prompts to run with-UpdateVirusTotalLink. - Error Handling: The script checks for the presence of
winget.exeandGet-WinGetPackage. If either is missing, it provides instructions and exits. - Performance: The script processes packages in parallel when updating the SHA256 cache to improve performance for large package lists.
- Encoding: Output files (
WingetListReport.mdandWingetListReport.html) are saved in UTF-8 encoding.
Tip: You can add an alias to your powershell $Profile file as:
Set-Alias -Name wgl -Value Get-WingetList
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m "Add your feature"). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
Please ensure your code follows PowerShell best practices and includes appropriate comments.
If you encounter bugs or have feature requests, please open an issue on the GitHub Issues page. Provide detailed information, including:
- PowerShell version
- Operating system
- Steps to reproduce
- Expected behavior
- Actual behavior
This project is licensed under the MIT License. See the LICENSE file for details.
- Built with PowerShell Core and the
Microsoft.WinGet.Clientmodule. - Inspired by the need to audit and manage software installations on Windows systems.
- Thanks to the open-source community for providing tools like
winget.
