Tuesday 6 March 2018

PowerShell: Script to run client cycle Actions that are configured in Configuration Manager

Created a script to run the below cycle actions.


Script:

$WMIPath = "\\" + $env:COMPUTERNAME + "\root\ccm:SMS_Client"
$SMSwmi = [wmiclass] $WMIPath
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000121}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000003}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000021}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000001}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000002}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000031}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000108}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000113}")
[Void]$SMSwmi.TriggerSchedule("{00000000-0000-0000-0000-000000000032}")



<#
Application Deployment Evaluation Cycle: {00000000-0000-0000-0000-000000000121}
Discovery Data Collection Cycle: {00000000-0000-0000-0000-000000000003}
Hardware Inventory Cycle: {00000000-0000-0000-0000-000000000001}
Machine Policy Retrieval and Evaluation Cycle: {00000000-0000-0000-0000-000000000021}
Software Inventory Cycle: {00000000-0000-0000-0000-000000000002}
Software Metering Usage Report Cycle: {00000000-0000-0000-0000-000000000031}
Software Updates Deployment Evaluation Cycle: {00000000-0000-0000-0000-000000000108}
Software Updates Scan Cycle: {00000000-0000-0000-0000-000000000113}
Windows Installer Source List Update Cycle: {00000000-0000-0000-0000-000000000032}
#>

Steps To DO:
1. Copy code and save the script as XXX.PS1
2. Set the execution policy to run the script.
3. Execute the script and it will run the above cycle actions.

No comments:

Post a Comment