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:

HKLM\SOFTWARE\Microsoft\CCM\CcmExec

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

143_1

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:

143_2

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:

Example #1

$ComputerName = $env:COMPUTERNAME
$ArgumentList = @($false)
Invoke-WmiMethod -Namespace "root\ccm" -Class "SMS_Client" -Name "SetClientProvisioningMode" -ComputerName $ComputerName -ArgumentList $ArgumentList

Example #2

$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:

143_3

I hope this helps!

Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(1908)

comments
  • Eden
    Posted at 22:34 June 16, 2016
    Eden
    Reply
    Author

    Hi Nickolaj, Thank you for your help again.

    I have a question regarding this Solution you have posted, I believe I am facing the same issue.
    I have clients set up for PKI, interestingly a few deployments comes back up without the Certificate installed (Control Panel, Configuration Manager Client shows NONE).

    My Main question is, where in the TS should I add this Powershell script? should I set up as bypass?

    Thank you

    Eden Oliveira

  • Chris
    Posted at 15:58 November 16, 2016
    Chris
    Reply
    Author

    Im currently working on upgrading our win7 envrionment to win10 using the in place win10 upgrade task sequence that recently came out with CM2012. We occasionally have been running into task sequence errors where the task sequence fails to disable the provisioning mode. I wanted to ask if the command that the task sequence uses to disable provisioning mode, what version of powershell does it need to be in. We’re thinking that the version of powershell (v3.0) might have issues with this command. Any help, thank you.

    • Nickolaj
      Posted at 08:57 November 25, 2016
      Nickolaj
      Reply
      Author

      You should not have any issues with running this command with PowerShell 3.0 to my knowledge. I’d suggest that you upgrade to ConfigMgr Current Branch so that you’re using a supported version of ConfigMgr to deploy or in-place upgrade to Windows 10 1607 and going forward.

      Regards,
      Nickolaj

  • Johnny
    Posted at 05:57 February 23, 2017
    Johnny
    Reply
    Author

    Hi Nickolaj, I ran the ps script, and the PSComputerName from the screen is showing the name of the reference computer. Is there any concerns? I use a build and capture task sequence to build the reference computer. Thanks in advance. Johnny.

  • Leave a Reply