Creates an inventory of installed apps and publishes as WMI object instances.
Beware that this project is in alpha stage. Breaking changes will occur.
The Win32_Product
has
7693
always been problematic, especially when it comes to WMI filters. The alternative is to use file or registry paths in your queries, which may or may not work for your use case. For local scenarios, PowerShell can save you but not for remote use cases or WMI filtering for Group Policies.
Also, the developer sometimes invent new ways of doing some tasks, which may not fit what Windows expects it. Therefore, it may not be reliable to use those commands, cmdlets or tools.
Here, I used Bulk Crap Uninstaller as an engine due to its amazing discovery capabilities.
Install the service and WMI provider using the installer. It will start discovery as soon as possible. You can then run queries against it:
Get-CimInstance -Class "ZB_App" |
Select-Object * -ExcludeProperty PSComputerName, Scope, Path, Options, ClassPath, Properties, SystemProperties, Qualifiers, Site, Container, __*
One of the good things is that you can use WMI filters for your Group Policies. For instance, you can query if Firefox installed with this PowerShell command, and you can use the same query for WMI filters.
Get-CimInstance -Query "SELECT Name FROM ZB_App WHERE Name LIKE 'Mozilla Firefox'"
The folder structure clearly shows the architecture of the software. The Windows service is split into two projects: the WindowsServiceProxy
and AppLister
. The AppLister
consists of the business logic, which can be imported and unit-tested. The WindowsServiceProxy
, on the other hand, is almost a generic Windows service executable which initiates the process.
All of the code is based on .NET Framework 4.8.1 due to the dependencies.
/root:
/installer: Inno setup code to compile the installer
/src:
/Engine: Bulk Crap Installer-based discovery engine.
/AppLister: The service class and utilities which include the business logic
/WmiProvider: The WMI Provider class `Package`, the core object populated and published to WMI.
/Tests: Unit tests
/WindowsServiceProxy: A reusable, skeleton Windows service executable that initiates the AppLister.
The scan engine is ripped off from Bulk Crap Uninstaller. This project minimized the engine to a list-only implementation by excluding many capacities including uninstallation. This project would not happen without Marcin Szeniak's work.