15 May 2013

Initiate Hardware Inventory

Posted By: Mick Pletcher - 12:56 PM


& Comment

Here is the scripting code in both powershell and VBScript to initiate a hardware inventory in both SMS and SCCM. The backend calls are the same in both SMS and SCCM, so both scripts will work in either app.

 Function InitiateHardwareInventory{  
      $SCCMClient = [wmiclass] "\\localhost\root\ccm:SMS_Client"  

 Sub InitiateHardwareInventory()  
      On Error Resume Next  
      DIM oCPAppletMgr  : Set oCPAppletMgr  = CreateObject("CPApplet.CPAppletMgr")  
      DIM oClientAction : Set oClientAction = Nothing  
      DIM oClientActions : Set oClientActions = oCPAppletMgr.GetClientActions()  
      For Each oClientAction In oClientActions  
           If oClientAction.Name = "Hardware Inventory Collection Cycle" Then  
           End If  
 End Sub  

About Mick Pletcher

My blog is here to help solve issues I have encountered and solved, publish scripts I have written, and educate others in understanding areas that are not well covered


Post a Comment

Copyright © 2013 Mick's IT Blogs™ is a registered trademark.