OBS: This post is primary about how to tattoo the registry with any given information, and then inventory it with SCCM2012.
In need of knowing when a client got it’s OS intalled/reinstalled? Read further. There is no built-in feature in ConfigMgr, that quickly enables you to find that piece information, which basically means we have to make our own.
In following post I will explain what I do, using hardware inventory in ConfigMgr 2012.
First off, we have to make sure that the information we need, in this instance, the date of OS deployment is created during the actual installation. This can be achieved in various ways. I choose to add an entry to the registry.
Running following commandline from within your OS task sequence does just that:
reg add “HKLM\Software\COMPANYNAME” /v InstallDate /t REG_SZ /d “%date%”
With this in place, we have what we need on the clientside. The command will leave a trace of the actual date of when the computer got installed.
Now we need to tell ConfigMgr how to use this, and for this I use hardware inventory.
Hardware inventory means changes to the configuration.mof. Download and use RegKeyToMof will make your life easier on this one: Download here
What you basically need to do, is to browse your way to the registrykey you wish to inventory. In this case HKLM\Software\COMPANYNAME\ and check off InstallDate. RegKeyToMof will automatically generate the necessary snippet of code to be inserted into the configuration.mof file and for your Client Settings in the ConfigMgr console.
Now update the client’s policy, run a new hardware inventory cycle and monitor the log files. InventoryAgent.log on the client, and dataldr.log on the server are relevant in this case. Datalgr.log vil start updating once the changes to configuration.mof has been done.
If everything goes as expected, you will be able to run a resource explorer on the client from the ConfigMgr console, and see something similar to this:
And finally from here, you will be able to use this information in queries or even build a report, and this way locate clients which haven’t been reinstalled for a long period of time.
4 thoughts on “Tattoo and inventory the registry”
Why not just use InstallDate from the already collected Operating System WMI class (Win32_OperatingSystem)?
Does exactly the same? 😉
Heine: How could I miss that .. 😛 Anyways, this is useful if you’d like to tattoo the clients with any information – not just install date. Thanks for the heads up though 🙂
Just tried this… I added the generated code to configuration.mof
Then I copied the other snippet of code and added that to client settings->set hardware classes..
but it fails..
The MOF file you tried to import could not be compiled. Ensure that the MOF file contains valid data. You can use the command line mofcomp utility to test the data.
I tried mofcomp and it fails with Class_sms_template not found..
I then added:
#pragma namespace (“\\\\.\\root\\cimv2”)
instance of __Namespace
Name = “SMS” ;
#pragma namespace (“\\\\.\\root\\cimv2\\SMS”)
to the mof file I created to import into sccm..
mofcomp now accepts the .mof file but sccm still fails with the same error.
do I need to do anything to initiate the new configuration.mof?
or am I overlooking something obvious?
I have never seen RegToMof generate code that SCCM would reject. Changes to configuration.mof is initiated the second you save the changes – whether they are done i notepad, or any other editor 🙂