Wednesday, 16 November 2022

SCCM Full Hardware Inventory Deleting the WMI instance

Run the SCCM Full Hardware Inventory

Deleting the WMI instance

Get-WmiObject -Namespace root\ccm\invagt -Class inventoryactionstatus | Where-Object {$_.inventoryactionid -eq "{00000000-0000-0000-0000-000000000001}"} | Remove-WmiObject 

Force a new hardware inventory 

Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule "{00000000-0000-0000-0000-000000000001}" 

To reset the hardware inventory cache 

Connect to the inventory agent namespace (root\ccm\invagt).

Delete the inventory action status instance for hardware inventory ({00000000-0000-0000-0000-000000000001}). 

Example 

The following example method shows how to reset the hardware inventory cache by connecting to the inventory agent namespace and deleting the inventory action status instance for hardware inventory. 

Visual Basic Script 

Sub ResetHardwareInventoryCache() 

     ' Get a connection to the "root\ccm\invagt" namespace. 

    Dim locator 

    Set locator = CreateObject("WbemScripting.SWbemLocator") 

    Dim services 

    Set services = locator.ConnectServer( , "root\ccm\invagt")  

    ' Delete the specified InventoryActionStatus instance. 

    services.Delete "InventoryActionStatus.InventoryActionID='{00000000-0000-0000-0000-000000000001}'"      

    ' Display message. 

    wscript.echo "Reset Hardware Inventory cache." 

End Sub

 

 

 


Share:

0 $type={blogger}:

Post a Comment