Adjusting the ConfigMgr Script Execution Timeout (pre 1810)

, , , , ,
ConfigMgr

In ConfigMgr, scripts that execute default to having an execution timeout of 60 seconds.  Normally this timeout is fine but you may run into situations where scripts run long and clients start receiving the following error in DcmWmiProvider.log.

In-line script execution time-out…
Failed to process CScriptProvider::PutInstanceAsync.
The script execution has timed out. (Error: 87D00321; Source: CCM)

ConfigMgr 1810 introduced the option to set the script timeout, if you are not up to 1810 yet and need to adjust the timeout then you are in the right place.  User raphael at thedesktopteam.com posted a blog on how to adjust the timeout, this is a good script for a single site infrastructure but the client setting does not flow down from a CAS to primary sites.  For this reason I adapted his original script to handle a multi-level site hierarchy.  Update the variables at the top of the script as required and run it to set the script execution timeout.

$SiteCode = "CM1"
$SiteServer = "CM1.contoso.com"
$ScriptTimeout = 120

$CCMAgents = (gwmi -Namespace root\sms\site_$SiteCode -Class SMS_SCI_ClientComp -ComputerName $SiteServer | where {$_.ClientComponentName -eq 'Configuration Management Agent'})

foreach ($CCMAgent in $CCMAgents)
{
    $props = $CCMAgent.Props
 
    for ($i = 0; $i -lt $props.count; $i++)
    {
        if ($props[$i].PropertyName -eq "ScriptExecutionTimeout")
        {
            $props[$i].Value = $ScriptTimeout
            break
        }
    }
 
    $CCMAgent.Props = $Props
    $CCMAgent.Put()
}

ALSO CHECK : Co-management - Multiple Pilot Policies
1 reply
  1. Sean
    Sean says:

    So “ConfigMgr 1810 introduced the option to set the script timeout” where do I find this? I can’t seem to find the option anywhere. I have 1810 installed. I assumed it would be in the admin tab somewhere but can’t find it.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

four × five =

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