Powershell : Extend SCCM Hardware Inventory

This scenario involves creation of new WMI classes on a PC to capture custom registry settings which have been populated using a script run from a GPO.

Create new WMI classes on an example PC

  • import WMI-Commands.psm1 module from https://gallery.technet.microsoft.com/WMI-PowerShell-cmdlets-ac049637
  • New-WMIClass -ClassName “BitLockerReport” in the Root\cimV2 namespace
  • New-WMIClass -ClassName “aaaa”,”bbbb” to create two new classes in Root\cimV2
  • New-WMIProperty -ClassName “BitLockerReport” -PropertyName “BitLockerHash”  (note that you can add -PropertyValue to define the default value for the new property

Add the new WMI classes to Client Settings

  • SCCM Console – Administration > Client Settings > Default Client Settings > Hardware Inventory
  • Click ‘Set Classes’
  • Click ‘Add …’ then ‘Connect …’
  • Connect to the example computer where you configured the new WMI class(es) including creds if necessary
  • Click the checkbox next to the required WMI class(es) then OK (expand the classes to view the Properties)

  • Click OK again to close the Client Settings

Edit the configuration.mof file to include the new WMI classes as follows :-

  • Create the required Registry entries on the example computer (with new WMI Classes)
  • Download and run RegKeyToMof (https://gallery.technet.microsoft.com/RegKeyToMof-28e84c28)
  • In the top part of the window navigate to the new registry entry
  • Click the ’64 bits only’ checkbox if you know the Wow6432Node will NOT be used then click ‘Save MOF’
  • Edit the SMSDEF.mof file to remove any comments not required
  • Confirm the ‘#pragma namespace’ is set correctly, ie, \\root\cimv2
  • Add comments before and after for better reading of the configuration.mof file, eg,

// ======================
// LOCAL ADMINS START
// ======================
      new entries here
// ======================
// LOCAL ADMINS END
// ======================

Note : it is essential the syntax used in configuration.mof is correct to prevent client errors.  PolicyEvaluator.log reports receipt of a new inventory policy and reports errors if incorrect :-

An incorrect configuration.mof file will result in the Hardware Inventory Cycle action being unavailable in the ConfigMgr Client in Control Panel.  The configuration.mof file is processed on the primary (or CAS) server when it is updated and can be tracked in the dataldr.log.

You can check if the updated classes have been received by your client by reviewing PolicyAgentProvider.log.

Related posts

Leave a Comment