October 30, 2009

Modifying SCCM to collect additional registry information during Hardware Inventory

Filed under: SCCM — Tags: , , , , , , , — Tim Lefler @ 9:22 am

We use System Center Configuration Manager (SCCM) 2007 in our shop to manage the windows environment.   Weekly we perform a SCCM “Hardware Inventory” and it collects tons of information using the WMI repository.  We wanted to extend this to collect asset information like Building, Floor, Room Number, etc.  We wrote a script that populates this information into each individual PC’s registry on a weekly basis……so now we need a way to extract that information and report on it using SCCM reports.

Below is an example of the type of information that we want to retrieve from the registry of each SCCM client.

hardware inventory isn’t really hardware inventory, it’s inventory from the WMI repository. WMI is most often associated with hardware and most of the default information stored in WMI is hardware related, but not all of it. This is of course significant when you look at the Resource Explorer and see Add/Remove Programs under it or when you want to extend inventory in Config to collect registry values and are told that it is handled by the hardware inventory process.
[HKEY_LOCAL_MACHINE\SOFTWARE\AssetInfo]
“Building-Floor”=”111/1″
“DetectedIP”=”10.X.X.X”
“Location”=”10100″
“PurchaseDate”=”10/27/2004 12:00:00 AM”
“LastUpdated”=”10/27/2009 3:09:49 PM”
“Status”=”Deployed”
“DeployDate”=”10/27/2009 12:00:00 AM”

Before we get into making any changes backup your MOF files on the SCCM server:

C:\Program Files\Microsoft Configuration Manager\inboxes\clifiles.src\hinv\sms_def.mof
C:\Program Files\Microsoft Configuration Manager\inboxes\clifiles.src\hinv\configuration.mof

Config Manager does not pull all WMI information available.  It pulls a subset that is defined in the sms_def.mof & configuration.mof files.  These files are  plain text files that can be edited with notepad and are formatted in “Managed Object Format” (MOF).  MOF is part of the WBEM/CIM standard and is documented somewhere on MSDN.
(more…)

October 28, 2009

SCCM Script to Initiate a Hardware Inventory

Filed under: SCCM — Tags: , , , , — Tim Lefler @ 10:37 am

This is a handy System Center Configuration Manager (SCCM) script that can be used to initiate a hardware inventory.

' Set the required variables. 
actionNameToRun = "Hardware Inventory Collection Cycle" 
 
' Create the CPAppletMgr instance. 
Dim controlPanelAppletManager 
Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr") 
 
' Get the available client actions. 
Dim clientActions 
Set clientActions = controlPanelAppletManager.GetClientActions() 
 
' Loop through available client actions. Run the matching client action when found. 
Dim clientAction 
For Each clientAction In clientActions 
	' To list available client actions, output using the Name property (below). 
	'wscript.echo "Action: " & clientAction.Name 
	If clientAction.Name = actionNameToRun Then 
		clientAction.PerformAction 
	End If 
Next 
wscript.echo " " 
wscript.echo "Ran: " & actionNameToRun

I’ve also used this code in a custom VB.Net application to initiate an inventory cycle.

I initially adapted this from a post found on TechNet here.

Powered by WordPress