Clean Up Old Hardware Inventory Data

1 minute read

In SCCM, after removing WMI classes that are no longer required from configuration.mof and sms_def.mof, the inventory data still exists in few places.

If you decide to clean them up, has a great WIKI page for SCCM hardware inventory which talked about different ways to clean up hardware inventory data.

I have tried the free SiteSweeper tool from which was mentioned in the WIKI page. It’s easy to use and you can remove multiple classes from site database at once:


Other than removing the data from site databases throughout the hierarchy, the WMI class which you defined in the configuration.mof still exists in the client. I didn’t bother to look further to find tools/utilities to delete WMI classes, but simple found a sample vbscript from MSDN to modify WMI classes, and modified a little bit:


wbemCimtypeString = 8             ' String datatype
Set objSWbemService = GetObject("Winmgmts:root\cimv2")
Set objClass = objSWbemService.Get()
objClass.Path_.Class = "name of WMI class you wish to delete"

' Remove the new class and instance from the repository
If Err <> 0 Then
WScript.Echo Err.Number & "    " & Err.Description
WScript.Echo "Delete succeeded"
End If

' Release SwbemServices object
Set objSWbemService = Nothing

To modify it, specify the WMI class you wish to delete on line 4. If the WMI class is not located in root\CIMV2 namespace, change line 2 as well.

I created a package in SCCM and advertised it to all systems.

Note: When you create the program, make sure you use the syntax “Cscript DeleteWMIClass.vbs” so the output is redirected to command prompt rather than a message box.

Leave a comment