Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line for Hardware Inventory

Status
Not open for further replies.

4MULA1

Technical User
Jun 8, 2001
41
CA
I am looking for the proper command line to initiate a Hardware and Software Inventory Cycle.

I can do this through the GUI System Management Tool on each of the Advanced Clients but I need the proper command line syntax.

SCJ
 
Here is a script I use when pushing certain apps when the advertisement is dependant on collection membership.

Note that the hardware inventory actually does pertain to installed apps.

'force hardware inventory for SMS client
On Error Resume Next
Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
Set actions = cpApplet.GetClientActions
For Each action In actions
If Instr(action.Name,"Hardware Inventory") > 0 Then
action.PerformAction
End if
Next

---

Here is another script that does a full inventory
that I use more frequently than the aforementioned. Written by Chris Stauffer.


'***************************************************************************

' SMS Advanced Client WMI Class Creation and Inventory

' written by Chris Stauffer

'***************************************************************************

'Steps:

'1. Reset Hardware Inventory Action to force a full inventory collection

'2. Hardware Inventory Action

'3. Reset Software Inventory Action to force a full inventory collection

'4. Software Inventory Action

'***********************************************

'Declare Variables

On Error Resume Next

Set sho = CreateObject("WScript.Shell")

strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")

strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))



' Get a connection to the "root\ccm\invagt" namespace (where the Inventory agent lives)

Dim oLocator

Set oLocator = CreateObject("WbemScripting.SWbemLocator")

Dim oServices

Set oServices = oLocator.ConnectServer( , "root\ccm\invagt")



'Reset SMS Hardware Inventory Action to force a full HW Inventory Action

sInventoryActionID = "{00000000-0000-0000-0000-000000000001}"

' Delete the specified InventoryActionStatus instance

oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"

'Pause 3 seconds To allow the action to complete.

wscript.sleep 3000

'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") > 0 Then

action.PerformAction

End If

Next



'Reset SMS Hardware Inventory Action to force a full HW Inventory Action

sInventoryActionID = "{00000000-0000-0000-0000-000000000002}"

' Delete the specified InventoryActionStatus instance

oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"

'Pause 3 seconds To allow the action to complete.

wscript.sleep 3000

'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

End If

Next








 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top