Udostępnij za pośrednictwem


SCCM Scripts

These SDK Scripts can perform ad-hoc client side tasks. 

NOTE: If running on x64 machine, you must use the 32-bit version of C:\Windows\SysWoW64\cscript.exe since SCCM is a 32-bit application.

Client Component List

On Error Resume Next

    Dim oCPAppletMgr ' Control Applet manager object
    Dim oClientAction ' Individual client action
    Dim oClientActions ' A collection of client actions

    ' Get the Control Panel applet manager object.
    Set  oCPAppletMgr=CreateObject("CPApplet.CPAppletMgr")
    If err.number <> 0 Then
        Wscript.echo "Couldn't create control panel application manager"

    End If

    ' Get a collection of actions.
    Set oClientActions=oCPAppletMgr.GetClientActions
    If err.number<>0 Then
        wscript.echo "Couldn't get the client actions"
        Set oCPAppletMgr=Nothing

    End If

    ' Display each client action name and perform it.
    For Each oClientAction In oClientActions
        wscript.echo oClientAction.name
        oClientAction.PerformAction
        wscript.echo
    Next

    Set oClientActions=Nothing
    Set oCPAppletMgr=Nothing

 

Hardware Inventory Cycle

' Set the required variables.
    actionNameToRun = "Hardware Inventory Collection Cycle"

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name = actionNameToRun Then
            clientAction.PerformAction 
        End If
    Next
    wscript.echo "Ran: " & actionNameToRun

 

Software Inventory Cycle

' Set the required variables.
    actionNameToRun = "Software Inventory Collection Cycle"

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available client actions.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name = actionNameToRun Then
            clientAction.PerformAction 
        End If
    Next
    wscript.echo "Ran: " & actionNameToRun

 

Discovery Collection Cycle

' Set the required variables.
    actionNameToRun = "Discovery Data Collection Cycle"

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name = actionNameToRun Then
            clientAction.PerformAction 
        End If
    Next
    wscript.echo "Ran: " & actionNameToRun

 

Machine Policy Cycle

' Set the required variables.
    actionNameToRun = "Request & Evaluate Machine Policy"

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name = actionNameToRun Then
            clientAction.PerformAction 
        End If
    Next
    wscript.echo "Ran: " & actionNameToRun

 

Software Metering Cycle

' Set the required variables.
    actionNameToRun = "Software Metering Usage Report Cycle"

    ' Create the CPAppletMgr instance.
    Dim controlPanelAppletManager
    Set controlPanelAppletManager = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim clientActions
    Set clientActions = controlPanelAppletManager.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim clientAction
    For Each clientAction In clientActions
        If clientAction.Name = actionNameToRun Then
            clientAction.PerformAction 
        End If
    Next
    wscript.echo "Ran: " & actionNameToRun

 

Software Updates Evaluation Cycle

' Set the required variables.
    actionNameToRun = "Software Updates Assignments Evaluation Cycle"

    ' Create a CPAppletMgr instance.
    Dim oCPAppletMgr
    Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")

    ' Get the available ClientActions object.
    Dim oClientActions
    Set oClientActions = oCPAppletMgr.GetClientActions()

    ' Loop through the available client actions. Run the matching client action when it is found.
    Dim oClientAction
    For Each oClientAction In oClientActions
        If oClientAction.Name = actionNameToRun Then
            oClientAction.PerformAction 
        End If
    Next

    wscript.echo "Ran: " & actionNameToRun

 

Software Updates Scan Cycle

' Set the required variables.
   actionNameToRun = "Updates Source Scan Cycle"

   ' Create a CPAppletMgr instance.
   Dim oCPAppletMgr
   Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")

   ' Get the available ClientActions object.
   Dim oClientActions
   Set oClientActions = oCPAppletMgr.GetClientActions()

   ' Loop through the available client actions. Run the matching client action when it is found.
   Dim oClientAction
   For Each oClientAction In oClientActions
       If oClientAction.Name = actionNameToRun Then
           oClientAction.PerformAction 
       End If
   Next
   wscript.echo "Ran: " & actionNameToRun

 

 

--