×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Command Line for Hardware Inventory

Command Line for Hardware Inventory

Command Line for Hardware Inventory

(OP)
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

RE: Command Line for Hardware Inventory

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








RE: Command Line for Hardware Inventory

I should have noted that these are vbs scripts. :D

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close