Trigger SCCM-client actions

If you need to trigger some SCCM-client actions via a script, this is a easy way to do it.

This script will trigger actions with “Request & Evaluate” in the name.

Option Explicit
Dim oCpApplet, oActions, oAction

On Error Resume Next
Set oCpApplet = CreateObject("CPAPPLET.CPAppletMgr")
If Err.Number <> 0 Then
    WScript.Echo "Missing SCCM-client"
    Err.Clear
Else
    WScript.Echo "Found following actions:"
    Set oActions = oCpApplet.GetClientActions
    For Each oAction In oActions
        If Instr(lCase(oAction.Name),"request & evaluate") Then
            WScript.Echo "  " & oAction.Name & " - Starting"
            oAction.PerformAction
        Else
            WScript.Echo "  " & oAction.Name
        End If
    Next
End If