Run Hardware or Software Inventory

This function can be used to trigger a Hardware or Software inventory.

To trigger Hardware inventory call the function using:

RunInventory(“Hardware”)

To trigger Software inventory call the function using:

RunInventory(“Software”)

Sub RunInventory(StrType)

	If StrType = "Hardware" Then
		StrType = "Hardware Inventory Collection Cycle"
	ElseIf StrType = "Software" Then
		StrType = "Software Inventory Collection Cycle"
	Else
		Exit Sub
	End If

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name =  StrType  Then
            clientAction.PerformAction  
        End If
    Next
    

End Sub