On Error Resume Next
ForceSoftwareInventory()
ForceHardwareInventory()
'*********************************************************************************************************
'Force Software Inventory on the Client
'*********************************************************************************************************
Function ForceSoftwareInventory()
Set sho = CreateObject("WScript.Shell")
strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
'Run a SMS Software Inventory
Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
Set actions = cpApplet.GetClientActions
For Each action In actions
If Instr(action.Name,"Software Inventory Collection Cycle") > 0 Then
action.PerformAction
' WScript.Echo action.name
End If
Next
End Function
'*********************************************************************************************************
'Force Hardware Inventory on the Client
'*********************************************************************************************************
Function ForceHardwareInventory()
Set sho = CreateObject("WScript.Shell")
strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
'Run a SMS Hardware Inventory
Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
Set actions = cpApplet.GetClientActions
For Each action In actions
If Instr(action.Name,"Hardware Inventory Collection Cycle") > 0 Then
action.PerformAction
' WScript.Echo action.name
End If
Next
End Function
2 comments:
Thanks for writing this.
no problem. glad to do it.
Post a Comment