T4 Off Canvas

This script performs all the actions as mentioned in the SCCM Client. The benefit is that you do not have to initiate each client action manually, the script takes care of it. 

 If run on a Windows 10 x64 with SCCM 2012 the output looks like:

SCCMClientActions W10

There are two versions: one for SCCM 2007 and earlier and one for SCCM 2012. The SCCM 2007 version uses the 32 bits wscript engine, also on 64 bits machines.

PerformSCCMClientActions (SCCM 2007 and earlier).vbs

' ================================================================================================
' Performs all the SCCM Client Actions
' Created by Willem-Jan Vroom
' 
' 0.0.1
'    Initial version
'
'
' ================================================================================================

' ------------------------------------------------------------------------------------------------
' Declare the most variables. 
' ------------------------------------------------------------------------------------------------

  Option Explicit

  Dim objFSO          : Set objFSO         = WScript.CreateObject("Scripting.FileSystemObject")
  Dim objShell        : Set objShell       = CreateObject("Wscript.Shell")
  Dim objCPAppletMgr  :
  Dim strWindir       : strWinDir          = objShell.ExpandEnvironmentStrings("%WinDir%")
  Dim Counter         : Counter            = 1
  Dim strText         : strText            = ""
  Dim strArchitecture : strArchitecture    = "x86"
  Dim strCommand      : strCommand         = ""
  Dim arrClientActions
  Dim objClientAction

' ------------------------------------------------------------------------------------------------
' Detect the current OS architecture.  
' ------------------------------------------------------------------------------------------------

  if objFSO.FolderExists(strWindir & "\syswow64") Then
     strArchitecture = "x64"
  end if

' ------------------------------------------------------------------------------------------------
' If run on a x64 OS run this script again but then with the 32 bits wscript.exe.
' SCCM Client is 32 bit only.
' ------------------------------------------------------------------------------------------------

  if strArchitecture = "x64" and instr(lcase(wscript.FullName),"system32") > 0 Then
     strCommand = strWinDir & "\syswow64\wscript.exe " & chr(34) & wscript.scriptfullname & chr(34)
     result = objShell.Run (strCommand,0,True)
     wscript.quit (result)
  end if

' ------------------------------------------------------------------------------------------------
' Perform all the SCCM Client Actions
' ------------------------------------------------------------------------------------------------

  On Error Resume Next

  Set objCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
  If Err.Number <> 0 Then
     msgbox "There is no SCCM Client installed on this system.",16,"SCCM Client Actions -- FAILED --"
     wscript.quit
  End if

  On Error Goto 0

' ------------------------------------------------------------------------------------------------
' Display the results
' ------------------------------------------------------------------------------------------------

  Set arrClientActions = objCPAppletMgr.GetClientActions()
  For Each objClientAction In arrClientActions
      objClientAction.PerformAction
      strText = strText & " -- Action: '" & objClientAction.Name & "' has been initiated successfully. " & vbCrLf
  Next
  strText = strText & vbcrlf & "Script engine: " & wscript.FullName & vbcrlf
  msgbox strText,64,"SCCM Client Actions"

' ================================================================================================
' END SCRIPT
' ================================================================================================

 

The script for SCCM 2012:

' ================================================================================================
' Performs all the SCCM Client Actions
' Created by Willem-Jan Vroom
' 
' 0.0.1
'    Initial version
'
'
' ================================================================================================

' ------------------------------------------------------------------------------------------------
' Declare the most variables. 
' ------------------------------------------------------------------------------------------------

  Option Explicit

  Dim objFSO          : Set objFSO         = WScript.CreateObject("Scripting.FileSystemObject")
  Dim objShell        : Set objShell       = CreateObject("Wscript.Shell")
  Dim objCPAppletMgr  :
  Dim strWindir       : strWinDir          = objShell.ExpandEnvironmentStrings("%WinDir%")
  Dim Counter         : Counter            = 1
  Dim strText         : strText            = ""
  Dim strArchitecture : strArchitecture    = "x86"
  Dim strCommand      : strCommand         = ""
  Dim arrClientActions
  Dim objClientAction

' ------------------------------------------------------------------------------------------------
' Detect the current OS architecture.  
' ------------------------------------------------------------------------------------------------

  if objFSO.FolderExists(strWindir & "\syswow64") Then
     strArchitecture = "x64"
  end if

' ------------------------------------------------------------------------------------------------
' Perform all the SCCM Client Actions
' ------------------------------------------------------------------------------------------------

  On Error Resume Next

  Set objCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
  If Err.Number <> 0 Then
     msgbox "There is no SCCM Client installed on this system.",16,"SCCM Client Actions -- FAILED --"
     wscript.quit
  End if

  On Error Goto 0

' ------------------------------------------------------------------------------------------------
' Display the results
' ------------------------------------------------------------------------------------------------

  Set arrClientActions = objCPAppletMgr.GetClientActions()
  For Each objClientAction In arrClientActions
      objClientAction.PerformAction
      strText = strText & " -- Action: '" & objClientAction.Name & "' has been initiated successfully. " & vbCrLf
  Next
  strText = strText & vbcrlf & "Script engine: " & wscript.FullName & vbcrlf
  msgbox strText,64,"SCCM Client Actions"

' ================================================================================================
' END SCRIPT
' ================================================================================================

 

Attachments:
Download this file (PerformSCCMClientActions.7z)PerformSCCMClientActions.7z[The scripts]1 kB