Configuration Manager Report on Custom Registry Key

The Issue

Recently I was at a customer that had a very specific requirement. They deploy Windows 10 via various methods and each method they use custom registry entries to identify the image details. The customer was looking for a way to report on these entries. The image details are identified as follow: 10.1803.1.2 where 10 = Windows 10, 1803 = Version, 1.2 = The image version.
On top of reporting these custom registry keys, they were also looking for a solution to update the version number as they upgrade from one build to the next.

The Solution

Extend hardware inventory in Configuration Manager by using the RegKeyToMof tool to convert the registry entry to a .mof file.
Use PowerShell to update the registry key with the current version/build number.


Open the RegKeyToMof tool and navigate to the registry entry in the upper left corner.

Next, change the ClassGroup and ClassName. This is an optional step, but I recommend doing this so that you can ensure that the mof edit is unique. In the examples above and below you can see that I changed both to Image Details

Create a MOF File

Open your configuration.mof file located here, <CM install directory>\inboxes\clifiles.src\hinv, and scroll to the bottom of the configuration.mof file. Next, append all of the text within the configuration.mof tab in RegKeyToMof.

Next copy the text from the “to import in Admin/AgentSettingsā€¦.” tab into a text file and save it as a .mof file.

Add the Hardware Inventory Classes in Microsoft Endpoint Configuration Manager

Note! This has to be applied on the Default Client Setting policy.

Open the Configuration Manager console and navigate to Administration – Client Settings and go to the properties of the Client Settings.
Navigate to Hardware Inventory.
Click on “Set Classes…”

Click on “Import

Select the .mof file you created and click “Import

You will notice that the two classes are imported and then click “OK

Now that the Hardware Inventory classes have been added we need to wait for the clients to start reporting inventory. This will take up to twice the usual hardware inventory cycle before the newly inventoried regkeys show up.

The Hardware Inventory collection of the custom registry key can be confirmed by opening the SQL Management Studio, connect to the SCCM Database, navigate to Views and select the “v_GS_ImageVersion640” view and right click and click on “Select top 1000 Rows”. This will show the data collected for the custom registry key.

The below SSRS query can be used to create a basic report:
OS.Caption0 AS [Operating_System],
from v_GS_ImageVersion640 REG
INNER JOIN v_R_System_Valid SYS
ON SYS.ResourceID = REG.ResourceID
ON SYS.ResourceID = OS.ResourceID

PowerShell to update registry key

The below PowerShell script can be used to update the registry key after Windows 10 Servicing is completed.

#Declare a variable for the current Windows 10 ReleaseID
$ReleaseID = Get-ItemPropertyValue “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion” -Name ReleaseId
#Declare a variable for the current Windows 10 Image Version
$CurrentVersion = Get-ItemPropertyValue “HKLM:\SOFTWARE\Image Version” -Name “Image Version”
#Declare a variable for the custom part of the SAPS image version to keep the last character.
$version = $CurrentVersion.Substring($CurrentVersion.Length-3)
#Set the new Windows 10 ReleaseID plus the “.” version of the Image
Set-ItemProperty -Path “HKLM:\SOFTWARE\Image Version” -Name “Image Version” -Value 10″.”$ReleaseID”.”$version