15 May 2013

Initiate Hardware Inventory

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.

Powershell
 Function InitiateHardwareInventory{  
      $SCCMClient = [wmiclass] "\\localhost\root\ccm:SMS_Client"  
      $SCCMClient.TriggerSchedule("{00000000-0000-0000-0000-000000000001}")  
 }  


VBScript
 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  
                oClientAction.PerformAction  
           End If  
      Next  
 End Sub  

Related Posts:

  • SCCM: Package not updating on the distribution points You have made changes to your installation package and it does not update on the distribution points, even after validating and redistributing. I ran into this issue and could not figure out why it was doing this. I ended up… Read More
  • Multiple Naming Schemas in the customsettings.ini file It is nothing new that you can setup MDT or SCCM to automatically create the computer name via the customsettings.ini file. This is a sample I used from a forum on the net: [ByLaptopType] Subsection=Laptop-%IsLaptop% … Read More
  • The Basics of SMS/SCCM MIF files Definition First off, the firm I work for still uses SMS 2003. MIF files are used in both SMS and SCCM. It sucks that there is so little information about MIF files. A MIF is a data snippet file that is collected and read wh… Read More
  • Custom Naming Distribution Points If you are using standard machines as distribution points in your remote offices, the naming might be an issue for you, as it was for us. There was nothing in the naming that distinguished them to allow us to know … Read More
  • Initiate Hardware Inventory 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. Powershell … Read More

0 comments:

Post a Comment