System Center 2012 ConfigMgr: Using VBS to Extend the DCM Script Execution Timeout Value

In System Center 2012 Configuration Manager, if you want to extend the execution timeout value(the default value is 60sec ) of the client to run the long time cusotmized script(such as file/user saerching) in your Configuration Item, then you can try to run following script for your site server to modify the site control setting, and make your client to refresh the policy to get the new timeout value.


0: Specify the new timeout value in script:

e.g.(set new value as 10mins): NewValue =          600

1: Save the script in a vbs file.

e.g.: test.vbs

2: Run the script by sepcify the site server and site code in a correct credential which has the permission the make the change on your site server.

e.g.: c:\cscript.exe test.vbs MySite PRS 

3: After it modified the value successfully, you can triger a machine policy retrieval and evaluation cycle for your client, then your client would download the latest policy and the value should be changed. To verify the new value applied on client, you can run wbemtest, and connect to the namespace "root\ccm\policy\machine\actualconfig" then run query: "Select ScriptExecutionTimeout from CCM_ConfigurationManagementClientConfig" to see if value has been changed.

-Script Body-

On Error Resume Next

' Define string variables

Class_Name =        "SMS_SCI_ClientComp"
Class_ItemName =    "Configuration Management Agent"
Class_ItemType =    "Client Component"
Property_Name =     "ScriptExecutionTimeout"
NewValue =          600

' Check command line parameters ?on failure, report the error and terminate.
' The SMS Provider server name and the site code are required.

set args=wscript.arguments

If args.Count = 2 then
    SMSProviderServer = UCASE(Wscript.Arguments(0))
    SiteCode = UCASE(Wscript.Arguments(1))
    wscript.Echo "Incorrect command line arguments." & vbCrLf & "Usage: cscript /nologo ModifySCFProperty.vbs <smsproviderserver> <sitecode>" & vbCrLf & "Example: cscript /nologo ModifySCFProperty.vbs SERVER1 S01" & vbCrLf
End If

' Connect to the SMS Provider ?on failure, report the error and exit.

SMSProviderServer = "\\" + SMSProviderServer + "\"
Set ObjSvc = GetObject("winmgmts:" & "{impersonationLevel=Impersonate,authenticationLevel=Pkt}!" & SMSProviderServer & "root\sms\site_" & SiteCode)

If Err.Number <> 0 Then
    wscript.Echo "Failed to connect to provider server with code: " & Err.Number & ".  Exiting!"
End If

' Get the requested instance of the class ?on failure, report the error and exit.

Set objInst = ObjSvc.Get(Class_Name & ".ItemName='" & Class_ItemName & "',ItemType='" & Class_ItemType & "',SiteCode='" & SiteCode &"'")

If Err.Number <> 0 Then
    WScript.Echo "Failed to open desired object with error code " & Err.Number & " (" & Err.Description & ").  Exiting!"
End If

' Loop through the properties until we find a match (or run out of properties) ?on failure, report the error and exit.

bFoundProperty = False

For Each objProp in objInst.Props
    If objProp.PropertyName = Property_Name Then
        bFoundProperty = True
        Exit For
    End If

If bFoundProperty = False Then
    WScript.Echo "Requested class instance was found but the property was not found.  Exiting without making any changes."
End If 

' Property found. Check to see if existing value matches, change it as appropriate - on failure to save, report the error and exit.

If objProp.Value = NewValue Then
    WScript.Echo "Property '" & Property_Name & "' found and matches the new value '" & NewValue & "'.  Not making any changes."
    OriginalValue = objProp.Value
    objProp.Value = NewValue

    If Err.Number <> 0 Then
        wscript.Echo "Failed to save the change with error code: " & Err.Number & ".  Exiting!"
        WScript.Echo "Property '" & Property_Name & "' successfully change from '" & OriginalValue & "' to '" & NewValue & "'."
    End If
End If


Besides, you can modify the class/property names in the script to modify other values to customize your site configuration.





Comments (12)

  1. Thiago says:

    Thanks a lot!!! Very hard solution!!! worked fine to me!!!

  2. Chris H says:

    Thank you.   Note – in your script you're missing the quotes around 600.  I think most SCCM admins would see that though – I hope 😉

  3. thomfroi says:

    Thank you for this nice contribution. It was a perfect solution for my problem.Good job!!

  4. Gerry V says:

    Thanks for this script, I've changed the value on my primary site server, but my clients not picking up this change. Clients still have the default value of 60.

  5. Try run it on CAS if you are in a hierarchy-

  6. Serg Danshin says:

    I'm trying this script now and it returned the successful result for both my CAS and three primaries. Clients have yet to update.

  7. Serg Danshin says:

    Updated value on all site servers and CAS. New Client policy deployed to clients, value still unchanged.


  8. Vijay iyer says:

    Hi I tried it on cas and primary server but still it does not change the value on the clients??

  9. Ballone says:

    I updated the value on my Primary and the client are not downloading the change with policy.  Has anyone got this to work??? Running SCCM 2012 R2 CU5.

  10. Ballone says:

    I actually found the update on all my agents using PolicySpy from the 2012 toolkit.  You need to look under Machine/Settings/CCM_ConfigurationManagementClientConfig/SiteSettingsKey/ScriptExecutionTimeOut.  So all of my agents did pickup the change after policy ran. I hope this helps.

  11. SK says:

    Hi Ballone, i am looking for "Machine/Settings/CCM_ConfigurationManagementClientConfig/SiteSettingsKey/ScriptExecutionTimeOut" is it under registry? or in WMI?

  12. Golfusmc - MSFT says:

    There is a known issue when changing the value to 600. Increase the value to 601 and it should work.

Skip to main content