Add HW Inventory class that does not exist in a default inventoried class

Hello all, 

I am trying to find a way to create a new class to supersede the win32_logicaldisk class. We are looking to add the VolumeDirty flag since it does not exist in the current SMS_logicaldisk class. However I cant seem to find a good way to do this. Has anyone done something like this before? Adding new classes doesn't seem to be difficult, but since this is a default WMI class that is being inventoried, I don't want to make any modifications to it as I know I will regret it down the road. I was thinking maybe creating a configuration item and inventorying it that way? Thoughts? Or is this even possible? Thanks in advance! 

Scott

March 17th, 2015 12:18pm

Hi,

Here are some articles to start with:

How to Extend Hardware Inventory in Configuration Manager

SCCM 2012 Customize / Extend Hardware Inventory

Free Windows Admin Tool Kit Click here and download it now
March 18th, 2015 2:50am

So what is wrong with adding a new class to collect this information? This will have no side effects down the road.
March 18th, 2015 5:29am

I do similar things--create a new I-Made-It-Up class to pull in something that the default doesn't.  I understand and agree with not modifying default classes--it perhaps would never be a problem--but if (perhaps maybe) some future upgrade or cumulative update failed to install because you modified a default class, it could be a sad sad day.  :)

If you want me to just write the mof edit for you, let me know.  Otherwise for a sample of how to do that; look at the mof edits for 'making up my own' SQL inventory: http://mnscug.org/blogs/sherry-kissinger/328-installed-sql05-sql08-sql12-sql14-version-information-via-configmgr-hardware-inventory

Essentially, you make up a configuration.mof edit; making a 'copy of' what you really want out of win32_logicaldisk, but you dump it into a cm_scott_x_awesomeness  (or whatever you want to call it), and you put that at the bottom of configuration.mof on your server.

Then your to-be-imported.mof into default client, hardware inventory, classes... import (if you're old skool, the sms_def.mof piece of it) will be a .mof file to inventory cm_scott_x_awesomeness

Just be careful to name what you really want to see in v_gs_NameThatView inside the quotes SMS_Group_Name and SMS_Class_ID.  You'll be living with that table and view name forever, so maybe, perhaps, calling it Scott_X_Awesomeness just might not be the best name ever (although it sounds great right now, at review time w/the boss maybe not so much).

Free Windows Admin Tool Kit Click here and download it now
March 18th, 2015 11:49am

Thank you Sherry! I should be able to do this, but I may ping you back if I have a question or two. But this makes a lot of sense. Thank you again!
March 18th, 2015 2:46pm

Sherry, 

Thanks again for your help. I have the following added to the configuration.mof:

#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass("cm_logicalDiskExtended", NOFAIL)
[Union, ViewSources{"select VolumeDirty from win32_logicaldisk"},ViewSpaces{"\\\\.\\Root\\cimv2"}, Dynamic,Provider("MS_VIEW_INSTANCE_PROVIDER")]

Class cm_logicalDiskExtended

{
[PropertySources{"VolumeDirty"} ] boolean VolumeDirty;
};

As well as this is the volumedirty.mof file I imported into the hw inventory:

 

[ dynamic, provider("MS_VIEW_INSTANCE_PROVIDER"),
  SMS_Report (TRUE),
  SMS_Group_Name ("Logical Disk Extension"),
  SMS_Class_ID ("CUSTOM|Logical_Disk_Extension|1.0")]
  class cm_logicalDiskExtended : SMS_Class_Template
  {
[SMS_Report (TRUE)] Boolean VolumeDirty;
  };

And when I force a HW inventory on a device, it is successful. (no errors below this line in the inv log.):

Collection: Namespace = \\.\root\cimv2; Query = SELECT __CLASS, __PATH, __RELPATH, VolumeDirty FROM cm_logicalDiskExtended; Timeout = 600 secs.

But when I look in WMI on the device, the class 'cm_logicaldiskextended' is there but there is no data in it. Am I missing something? 

Free Windows Admin Tool Kit Click here and download it now
March 19th, 2015 12:16pm

Yeah, what you're missing are the ,key fields.  Even though you don't actually care about them for reporting purposes <grin> whatever fields are ',key' in the default logicaldisk, you want them as well in your extension.  For inventory to work and report, it wants key fields.  and since MS has done the work for you for 'which' key fields are needed, just use the same ones. 

If you're looking in default client settings, hardware inventory, classes, the key fields for logicaldisk are the ones that are bolded in that dialogue.

so you want them in both your configuration.mof and your import_this.mof

(and you didn't call it Scott_x_Awesomeness?  :)

March 19th, 2015 1:01pm

Ha! yeah it was in the plans to name it Scott_X_Awesomness but unfortunately I dont think the client would be thrilled with it! :) 

Seriously thank you for your help! Been looking at that damn code all morning and tried to compare it with what you did and I would have never figured that I needed the 'key' fields. Thank you again, you're amazing! :)

Free Windows Admin Tool Kit Click here and download it now
March 19th, 2015 2:05pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics