How to Trigger ConfigMgr Hardware Inventory using PowerShell

Here's a brief "How To" for initiating hardware inventory on a remote system using Windows PowerShell.  Here it is in simple form:

$SMSCli = [wmiclass] "\\myComputerName\root\ccm:SMS_Client"
$SMSCli.TriggerSchedule("{00000000-0000-0000-0000-000000000001}")

As you can see, in the first line of code we're connecting to the SMS_Client class, in the root\ccm namespace, on the computer named MyComputerName. In the second line of code, we're calling the method TriggerSchedule, with the ScheduleID = {00000000-0000-0000-0000-000000000001}. Review the InventoryAgent.log file on the remote computer to verify hardware inventory ran successfully.

As you may know, there are many other ScheduleIDs that can be triggered using this process. Review the ConfigMgr SDK under the section titled TriggerSchedule Method in Class SMS_Client for more information.  Here is a table of the most common ScheduleIDs:

Name ScheduleID
HW Inventory {00000000-0000-0000-0000-000000000001}
SW Inventory {00000000-0000-0000-0000-000000000002}
Discovery Data Record {00000000-0000-0000-0000-000000000003}
Machine Policy Retrieval & Evaluation {00000000-0000-0000-0000-000000000021}
File Collection {00000000-0000-0000-0000-000000000010}
SW Metering Usage Report {00000000-0000-0000-0000-000000000022}
Windows Installer Source List {00000000-0000-0000-0000-000000000032}
Software Updates Scan {00000000-0000-0000-0000-000000000113}
Software Updates Store {00000000-0000-0000-0000-000000000114}
Software Updates Deployment {00000000-0000-0000-0000-000000000108}

You  can use this command extract a few more ScheduleIDs available to you (yes, four lines for this one command - you should be able to paste into a PowerShell prompt without issue):

get-wmiobject CCM_Scheduler_ScheduledMessage `
    -namespace root\ccm\policy\machine\actualconfig |
    select-object ScheduledMessageID, TargetEndPoint |
    where-object {$_.TargetEndPoint -ne "direct:execmgr"}

 

Stay tuned for how to write a function to make the process of initiating these actions on multiple systems a little easier for you.

 

 

Greg

ramseyg@hotmail.com

Published Tuesday, May 27, 2008 4:44 PM by gramsey

Comments

# How to Trigger ConfigMgr Hardware Inventory using PowerShell

Pingback from  How to Trigger ConfigMgr Hardware Inventory using PowerShell

Powered by Community Server (Commercial Edition), by Telligent Systems