Trigger SCCM Client Action with PowerShell

Hello,

You SCCM agent has a set of action that you can trigger manually from the control panel :

SCCMAgent-Actions

You can trigger those actions with PowerShell with his COMObject :

PS C:> $SCCMClient = New-Object -COM 'CPApplet.CPAppletMgr'
PS C:> $SCCMClient
System.__ComObject
PS C:> $SCCMClient | Get-Member


   TypeName: System.__ComObject#{279463bb-1034-4fb5-878e-4a330a08beab}

Name                MemberType Definition
----                ---------- ----------
GetClientActions    Method     IClientActions GetClientActions ()
GetClientComponents Method     IClientComponents GetClientComponents ()
GetClientProperties Method     IClientProperties GetClientProperties ()


PS C:>
PS C:> $SCCMClient.GetClientActions()

ActionID                               Name                                          DisplayNameResID DisplayNameResDLL
--------                               ----                                          ---------------- -----------------
{8EF4D77C-8A23-45c8-BEC3-630827704F51} Request & Evaluate Machine Policy                        10008 cfg_res.dll
{00000000-0000-0000-0000-000000000113} Updates Source Scan Cycle                                10013 cfg_res.dll
{3A88A2F3-0C39-45fa-8959-81F21BF500CE} Request & Evaluate User Policy                           10007 cfg_res.dll
{00000000-0000-0000-0000-000000000101} Hardware Inventory Collection Cycle                      10001 cfg_res.dll
{00000000-0000-0000-0000-000000000102} Software Inventory Collection Cycle                      10005 cfg_res.dll
{00000000-0000-0000-0000-000000000123} Application Global Evaluation Task                       10014 cfg_res.dll
{00000000-0000-0000-0000-000000000108} Software Updates Assignments Evaluation Cycle            10011 cfg_res.dll
{00000000-0000-0000-0000-000000000103} Discovery Data Collection Cycle                          10004 cfg_res.dll
{00000000-0000-0000-0000-000000000107} MSI Product Source Update Cycle                          10010 cfg_res.dll
{00000000-0000-0000-0000-000000000104} Standard File Collection Cycle                           10006 cfg_res.dll


PS C:>
PS C:> $SCCMClient.GetClientActions()[3]

ActionID                               Name                           DisplayNameResID DisplayNameResDLL
--------                               ----                           ---------------- -----------------
{3A88A2F3-0C39-45fa-8959-81F21BF500CE} Request & Evaluate User Policy            10007 cfg_res.dll


PS C:> $SCCMClient.GetClientActions()[3] | Get-Member


   TypeName: System.__ComObject#{f2f82c75-25fa-489e-a875-caf086a0449b}

Name              MemberType Definition
----              ---------- ----------
PerformAction     Method     void PerformAction ()
ActionID          Property   string ActionID () {get}
DisplayNameResDLL Property   string DisplayNameResDLL () {get}
DisplayNameResID  Property   int DisplayNameResID () {get}
Name              Property   string Name () {get}


PS C:> $SCCMClient.GetClientActions()[3].PerformAction()
PS C:>

This can be useful to force some SCCM action in your logon scripts.

One thought on “Trigger SCCM Client Action with PowerShell

  1. Thank you for the great article. This saved me a ton of time in writing a self remediation script for clients.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.