Force a ConfigMgr Client out of Provisioning Mode with PowerShell
I’ve seen many blog posts around the internet regarding the issue where the client may still be in Provisioning Mode after an OSD scenario. Almost all of the posts describe a method of changing a registry value, which in fact works, but it’s not the correct and supported way. Instead there’s a WMI method called SetClientProvisioningMode that should be used to either put the client into Provisioning Mode or take it out of it. In this post I’ll describe the easy steps that you can take to use PowerShell to invoke this method. It’s important to point out thought that this is a last resort fix, so I’d encourage you to go to the bottom and troubleshoot the root cause why the clients get stuck in Provisioning Mode.
Server WMI Method information
There’s a registry value called ProvisioningMode residing in the following location:
The data of this value can be either True or False, and is what tells the ConfigMgr client to be in Provisioning Mode if it’s set to True, and not if it’s set to False. In those scenarios where the client is not taken out of Provisioning Mode after an OSD, the data would be set to True, you should invoke a WMI method called SetClientProvisioningMode. If you run the following PowerShell one-liner, we can see the Parameters that the we need to give to the method once we invoke it:
(Get-CimClass -Namespace "root\ccm" -ClassName SMS_Client).CimClassMethods["SetClientProvisioningMode"].Parameters
As we can see in the above screenshot, there’s a In Parameter with the name of bEnable that accepts a value as boolean (true or false). Now that we know what value we need to specify as input for the method parameter, we can execute the method with PowerShell.
Execute SetClientProvisioningMode method with PowerShell
We can execute this method with the parameter we want in varous ways, and I’m going to show you two of those in this post. The scenario here is that we have a ConfigMgr client that was not taken out of Provisioning Mode after OSD, and we need to correct that. If we take a look in the registry of that client, it would look like this:
As shown in the above screenshot, the value ProvisioningMode is set to True meaning it’s in Provisioning Mode. Below is the two code examples that we can run in order to turn this registry value into false:
$ComputerName = $env:COMPUTERNAME $ArgumentList = @($false) Invoke-WmiMethod -Namespace "root\ccm" -Class "SMS_Client" -Name "SetClientProvisioningMode" -ComputerName $ComputerName -ArgumentList $ArgumentList
$ComputerName = $env:COMPUTERNAME $WmiClass = [WmiClass]"\\$($ComputerName)\root\ccm:SMS_Client" $InParameter = $WmiClass.PSBase.GetMethodParameters("SetClientProvisioningMode") $InParameter.bEnable = $false $WmiClass.PSBase.InvokeMethod("SetClientProvisioningMode", $InParameter, $null)
Both of the examples above will perform the same action, I’m just referencing different approaches that you could take in order to get the same result. Now when we take a look in the registry again on the client, ProvisioningMode should now be set to false:
I hope this helps!
Principal Consultant and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Currently working for TrueSec as a Principal Consultant. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences and user groups.