16 July 2013

SCCM: Initiate Hardware Inventory from an application package

Posted By: Mick Pletcher - 2:13 PM


& Comment

You have setup an application package and want to initiate a hardware inventory immediately after the software is installed. Here is a powershell script that will initiate the hardware inventory, verify it was initiated and return an error code 0 if initiated back to SCCM. This allows the hardware inventory to become an application with a return value to look for by injecting the script in as a custom script as the detection method.

You can download the script from here to inject into SCCM.

 Set-Variable -Name a -Scope Global -Force  
 Set-Variable -Name SMSCli -Scope Global -Force  
 $SMSCli = [wmiclass] "root\ccm:SMS_Client"  
 $a = $SMSCli.TriggerSchedule("{00000000-0000-0000-0000-000000000001}")  
 If ($a.__PROPERTY_COUNT -eq 1) {  
      Remove-Variable -Name a -Scope Global -Force  
      Remove-Variable -Name SMSCli -Scope Global -Force  
      exit 0  
 } else {  
      Remove-Variable -Name a -Scope Global -Force  
      Remove-Variable -Name SMSCli -Scope Global -Force  
      exit 1  

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


  1. I really like your blog. You have a sense of humor and very informative article. Thank you for sharing. Keep up the good work.



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