Add UninstallString to Hardware Inventory

Version: SCCM 2012 SP1 CU2

Note: If you upgrade to SCCM 2012 R2, you may need to repeat Part 1 again if previously configured.

The following method can be used to add the “UninstallString” to Hardware Inventory for each application installed on client machines. This could be helpful to gather MSI product codes if you need to remove several applications via script or software distribution methods.

By default, SCCM does hardware inventory (when enabled) on the following registry keys within the Uninstall section: ProductID (ProdID), DisplayName, InstallDate, Publisher, DisplayVersion. However, the “UninstallString” is not inventoried by default. This registry value is found under the following locations.

Default location under 32-bit and 64-bit operating systems:

  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\UninstallString

Default location under 64-bit operating systems for 32-bit apps:

  • HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\UninstallString

In order to inventory these registry values, there are 2 areas that require modification.

  1. Modifying Hardware Inventory reporting classes under Client Settings.
  2. Modifying the configuration.mof

Part 1 – Modifying Hardware Inventory Reporting Classes (instructing clients to report)

Within the CM console, navigate to Administration -> Client Settings. Right-click on “Default Client Settings” and select properties.


Select Hardware Inventory and click on “Set Classes”.


Expand the “Installed Applications” categories. There should be two classes for 32 and 64 bit apps. Notice carefully that there is no “UninstallString” property to place a checkmark. We need to first add this property to the existing reporting classes. In SCCM 2007, this would be accomplished by modifying the SMS_DEF.mof file. However, this file does not exist in SCCM 2012. Instead, we’ll take a slightly different approach. But, the concept should be the same.

Click the “Export” button and save a copy of the exported file as “Before.mof”.


Make a copy of the Before.mof file and save it as After.mof. Then open the After.mof using Notepad.

Locate the Win32Reg_AddRemoveProgram64 and Win32Reg_AddRemoveProgram32 reporting classes. For each class, add the following lines:

    [ SMS_Report (TRUE) ]
    String     UninstallString;

See the following example image.


Save and close the After.mof file. Go back to Hardware Inventory Classes in the CM console and click the “Import” button.


Locate and select the After.mof file. Click the Open button to import.


You can leave the default to “Import both hardware inventory classes and hardware inventory class settings”. We’ve only made a slight change to two hardware inventory classes. The import process will ignore anything else that remains the same.

Before clicking the Import button on this screen, scroll down to the bottom.


You will notice the only changes made will be the two hardware inventory classes modified.

Click Import.


Now, there will be an “UninstallString” property for both classes in the console.


Optionally, WMI can be inspected via PowerShell from the site server. Verify Win32_AddRemovePrograms and Win32_AddRemovePrograms64 under the “root\cimv2\sms\inv_temp” namespace now have the “UninstallString”  within it’s properties. This is verifying that the site server has correctly changed the reporting classes for hardware inventory within it’s own WMI.

From the SCCM site server using the Powershell command prompt:

(Get-WmiObject -class Win32Reg_AddRemovePrograms -Namespace “root\cimv2\sms\inv_temp” -list | select properties).properties | Where-Object {$_.Name -eq “UninstallString”}

(Get-WmiObject -class Win32Reg_AddRemovePrograms64 -Namespace “root\cimv2\sms\inv_temp” -list | select properties).properties | Where-Object {$_.Name -eq “UninstallString”}


At this point, we have instructed SCCM to modify it’s hardware inventory policy to collect WMI class data from client machines. Specifically, we are asking clients to include an additional property called “UninstallString” when reporting WMI classes Win32Reg_AddRemovePrograms and Win32Reg_AddRemovePrograms64 from the “root\cimv2” namespace.

Clients already report these classes by default when hardware inventory is enabled. However, now it will also gather the “UninstallString” property (if it exist locally, but this class property does not exist quite yet on client machines).

The next part describes instructing clients to begin storing the “UninstallString” within WMI locally. Notice the difference between “instructing clients on reporting” versus “instructing clients to store locally in WMI”.

Part 2 – Modifying Configuration.mof (instructing clients to store locally in WMI)

Navigate to the location of the configuration.mof on your site server. This is typically in the following location;

<SCCM install path>\inboxes\clifiles.src\hinv

First, make a backup copy of the existing configuration.mof file. Next, edit the existing file using Notepad. I recommend making the edit change from a temporary location in case you make multiple saves.

Locate the Win32Reg_AddRemovePrograms and Win32Reg_AddRemovePrograms64 classes in the configuration.mof.  Add the following lines to each class:

        string    UninstallString;

See the following example image.


Once this file is saved, SCCM will process this new file for clients to begin downloading. Upon downloading, clients will compile the new configuration.mof.

After sufficient time has passed, you can optionally inspect WMI using Powershell on any SCCM client machine.

Get-WmiObject Win32Reg_AddRemovePrograms | Get-Member
Get-WmiObject Win32Reg_AddRemovePrograms64 | Get-Member


As clients send hardware inventory, you can create reports on data by using the following views in the CM SQL database:


The uninstall strings will be stored under the “UninstallString0” column.