Configuration Manager site database contains a large collection of information about the network, computers, users, user groups, and many other components of the computing environment. Being SCCM Admin, you need to understand the different categories of the SQL views, what information is stored in each view, and how the SQL views can be joined to one another to create reports that return the required information. For more information about SQL views please refer https://gallery.technet.microsoft.com/SCCM-Configmgr-2012-R2-SQL-5fefdd3b
Hardware inventory views contain information about the computer hardware .Many hardware inventory views are created in ConfigMgr by default, and many can be enabled or created using the hardware inventory classes dialog box, accessible from client settings. Because of this, it is likely that ConfigMgr sites collect different hardware inventory resulting in different hardware inventory views.
If you want to know more about how extend hardware inventory in ConfigMgr ,please refer https://docs.microsoft.com/en-us/sccm/core/clients/manage/inventory/extend-hardware-inventory
The question in title was asked by one of my customer as they have lot of custom hardware inventory classes imported and they want to find a way to list-down all such custom hardware inventory classes.
Why is it important to know the list of custom hardware inventory classes that are imported (MOF changes)?
One of the reason i would think is ,to asses if these custom changes are still needed by the organization . If you have too many custom mof changes ,it enlarges the database and also impact clients sending huge inventory file back to site server for processing.
The simple way to check the custom MOF configuration is to look at the configuration.mof file that is located in <SCCM installation dir>:\inboxes\clifiles.src\hinv but i started looking around database for list rather taking notes from the configuration.mof file.
This blog post will help you to get list of custom MOF imported to client device settings (Note: If you enable any of the existing classes not via MOF import in inventory settings, it is not covered in this post).
After going through the SQL views documentation ,found that ,there is one view called v_InventoryClass that store all inventory classes enabled in hardware inventory client settings.
v_InventoryClass Lists the WMI classes that are collected by ConfigMgr hardware inventory by class ID. The view also shows the WMI namespace, the class name and the name of the class as it will be displayed in Resource Explorer.
So i started querying this SQL view for the inventory classes.
select count(*) Total from v_InventoryClass
There are total of 161 inventory classes enabled in client device settings .
Out of these 161, how do we tell the custom inventory classes (MOF IMPORT)?
By looking at above 161 classes , i thought to pick ‘isDeletable’ because all default classes that comes with Configmgr installation ,would not give you option to delete , which is not TRUE.
For for the WMI classes that are enabled by default at the time of ConfigMgr installation or available for you to enable can also be deleted from inventory settings.
So my next key observation was at SMSClassID.
For all default classes that are enabled at the time of ConfigMgr installation will start with Mcrosoft|.
Any custom inventory classes will not have Microsoft as starting word.
With this information ,i started creating SQL Query with count.
select tmp.[Inventory Type] ,count(*) Total from
(
select case when IC.SMSClassID like 'Microsoft|%' then 'Default' else 'Custom' end as 'Inventory Type'
from v_InventoryClass IC
) tmp
group by tmp.[Inventory Type]
To see the list of custom MOF changes ,following is the SQL query:
select * from v_InventoryClass IC
where ic.SMSClassID not like 'Microsoft|%'
Hope this helps!