ConfigMgr’s Hardware Inventory feature allows information from WMI on a PC to be easily transferred and recorded in the ConfigMgr database for reporting, or collection targeting purposes.

Performed on: Configuration Manager 2007 R3

In this example, I intend to collect the DNS client (primary and secondary) settings and the DNS domain search suffix order. I know this information is stored in the Win32_NetworkAdapterConfiguration class in WMI. (You can find what attributes and information are stored in WMI by using Powershell – get-wmiobject, Windows Management Instrumentation Tester – wbemtest, or MSDN.

Planning the change

This WMI Class is represented in ConfigMgr already as it’s included in the default reporting classes. I can find out which attributes are collected by checking the database, creating a report, creating a query or checking the SMS_Def.mof file directly.

Database view V_GS_NETWORK_ADAPTER_CONFIGUR
Database History View V_HS_NETWORK_ADAPTER_CONFIGUR
Query Editor Class Network Adapter Configurationclass
SMS_Def.mof  sms_def_before

As you can see from the screenshot above, I can see that the DNSDomainSuffixSearchOrder and DNSServerSearchOrder are set to FALSE. These are the attributes I want! I can confirm they are the attributes I am looking for and what format they are in by using the WMI tools I mentioned earlier. (in this case I’m only interested in adapters that have IP enabled).
Powershell command

get-wmiobject Win32_NetworkAdapterConfiguration | where {$_.ipenabled -eq $true} | fl *

Results
DHCPLeaseExpires :
Index : 7
Description : vmxnet3 Ethernet Adapter
DHCPEnabled : False
DHCPLeaseObtained :
DHCPServer :
DNSDomain :
DNSDomainSuffixSearchOrder : {suffix1.com;suffix2.com}
DNSEnabledForWINSResolution : False
DNSHostName : SERVER
DNSServerSearchOrder : {10.0.0.1, 10.0.0.2}
DomainDNSRegistrationEnabled : False
FullDNSRegistrationEnabled : True
IPAddress : {10.0.0.3, fe80::0000:0666:6666:6666}
IPConnectionMetric : 5
IPEnabled : True
IPFilterSecurityEnabled : False
WINSEnableLMHostsLookup : False
WINSHostLookupFile :
WINSPrimaryServer : 10.0.0.1
WINSScopeID :
WINSSecondaryServer :
__GENUS : 2
__CLASS : Win32_NetworkAdapterConfiguration
__SUPERCLASS : CIM_Setting
__DYNASTY : CIM_Setting
__RELPATH : Win32_NetworkAdapterConfiguration.Index=7
__PROPERTY_COUNT : 61
__DERIVATION : {CIM_Setting}
__SERVER : CHQSMS3
__NAMESPACE : rootcimv2
__PATH : \SERVERrootcimv2:Win32_NetworkAdapterConfiguration.Index=7
ArpAlwaysSourceRoute :
ArpUseEtherSNAP :
Caption : [00000007] vmxnet3 Ethernet Adapter
DatabasePath : %SystemRoot%System32driversetc
DeadGWDetectEnabled :
DefaultIPGateway : {10.0.0.1}
DefaultTOS :
DefaultTTL :
ForwardBufferMemory :
GatewayCostMetric : {256}
IGMPLevel :
InterfaceIndex : 11
IPPortSecurityEnabled :
IPSecPermitIPProtocols : {}
IPSecPermitTCPPorts : {}
IPSecPermitUDPPorts : {}
IPSubnet : {255.255.255.0, 64}
IPUseZeroBroadcast :
IPXAddress :
IPXEnabled :
IPXFrameType :
IPXMediaType :
IPXNetworkNumber :
IPXVirtualNetNumber :
KeepAliveInterval :
KeepAliveTime :
MACAddress : 00:00:00:00:00:00
MTU :
NumForwardPackets :
PMTUBHDetectEnabled :
PMTUDiscoveryEnabled :
ServiceName : vmxnet3ndis6
SettingID : {B95B2856-6995-4355-A6C7-84088AA9E739}
TcpipNetbiosOptions : 0
TcpMaxConnectRetransmissions :
TcpMaxDataRetransmissions :
TcpNumConnections :
TcpUseRFC1122UrgentPointer :
TcpWindowSize :
Scope : System.Management.ManagementScope
Path : \SERVERrootcimv2:Win32_NetworkAdapterConfiguration.Index=7
Options : System.Management.ObjectGetOptions
ClassPath : \SERVERrootcimv2:Win32_NetworkAdapterConfiguration
Properties : {ArpAlwaysSourceRoute, ArpUseEtherSNAP, Caption, DatabasePath...}
SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers : {dynamic, Locale, provider, UUID}
Site :
Container :

Making the change

Now that I know what I want to change, I need to do it!

  1. Test and change control!
  2. Open \<servername>SMS_<sitecode>inboxesclifiles.srchinv  (or <configmgr installation directory>inboxesclifiles.srchinv)
  3. Save a backup of sms_def.mof (I usually copy to a file and rename the file to sms_def.mof.backup<year><month><date>, eg sms_def.mof.backup20130723)
  4. Open sms_def.mof in Notepad
  5. Find the class you are looking to modify
  6. Find the attribute you want to add
  7. Change the FALSE value to TRUE for the section immediately preceding the attribute name:
    Before After
    sms_def_before2 sms_def_after
  8. Save the file
  9. Copy to all primary servers (<configmgr installation directory>inboxesclifiles.srchinv)
  10. Update your configuration documentation (this is important, as ConfigMgr upgrades typically overwrite the sms_def.mof file which will usually remove any changes you made).

Monitoring the change

Recommended (but not required) steps:

  1. Install System Center Configuration Manager 2007 Toolkit V2 on the client and server you will be monitoring the change from
  2. Open Trace32 from the Start Menu under ConfigMgr 2007 Toolkit V2
  3. Select Yes to make it your default log (.log) viewer

To monitor the change occurring successfully, perform these steps:

  1. Log on to a client (or perform on the server if it has a ConfigMgr client)
  2. Open PolicySpy from the Start Menu under ConfigMgr 2007 Toolkit V2
  3. Select the Events tab
  4. On a client connected to your primary server, initiate a Machine Policy Retrieval and Evaluation Cycle (from the Configuration Manager control panel applet, actions tab)
  5. Monitor PolicySpy until you see the event PolicySettingsEvaluationComplete
  6. Initiate a Hardware Inventory Cycle from the ConfigMgr control panel applet
  7. On the server, open <configmgr installation directory>logsdataldr.log
  8. Wait for the following events
    Processing Inventory for Machine: CLIENTMACHINENAME   Version 1.67  Generated: 07/22/2013 17:12:04
    Defining attributes for group MICROSOFT|NETWORK_ADAPTER_CONFIGURATION|1.0...
    CGroup::DefineAttributes - Detected schema change. Waiting for the threads to finish the queue.
    Thread 4124 has been granted exclusive access.
    CGroup::DefineAttributes - Proceeding with schema change.
    CSqlSchema::CreateProcedure pNetwork_DATA at 07/22/13 17:12:13
    CSqlSchema::CreateProcedure dNetwork_DATA at 07/22/13 17:12:13
    done
  9. Check the data is now in the database:
    SELECT *
    FROM v_GS_NETWORK_ADAPTER_CONFIGUR
    where DNSServerSearchOrder0 is not null

Rollback

Removing doesn’t work quite as well. You can stop the attributes from being collected and updated by reversing the process, however you will notice that the database still contains the attributes and their previous values.

A colleague of mine did suggest that this could be removed by selecting all the data from the table to a temp table, dropping the table, and re-creating it without the columns. However this should only be performed with the blessing of Microsoft Support and would most certainly not be supported otherwise as direct database modification is not supported.

More information

This article just covers adding attributes to existing classes, to add other information, see How to Extend Hardware Inventory.

References