WPNinjas HeaderWPNinjas Header

Prepare Configuration Manager Client failed with Exit Code 0xffffffff

Multiple times I had the problem that I couldn’t generate my new WIM File because it failed in one of the last steps –> The Prepare Configuration Manager Client Step failed with Exit Code 0xffffffff.

This made me feel a little bit angry because I always had to wait a few hours until I got my new Image. In the Internet I could only find the solution to not install all Windows Updates in the OSI Task Sequence. That was not an option for me. So mostly solved the problem with using a faster virtual machine with SSD Harddisk, then the image could be created successfully,

The Error

The error message in the status viewer and the smsts.log was:

The task sequence execution engine failed executing the action (Prepare Configuration Manager Client) in the group (Capture the Reference Machine) with the error code 4294967295
Action output: … 1 instance(s) of ‘SMS_MaintenanceTaskRequests’ successful
Successfully reset Registration status flag to “not registered”
Successfully disabled provisioning mode.
Start to cleanup TS policy
getPointer()->ExecQuery( BString(L”WQL”), BString(pszQuery), lFlags, pContext, ppEnum ), HRESULT=ffffffff (e:\nts_sccm_release\sms\framework\core\ccmcore\wminamespace.cpp,463)
ns.Query(sQuery, &spEnum), HRESULT=ffffffff (e:\qfe\nts\sms\framework\tscore\utils.cpp,3666)
End TS policy cleanup
TS::Utility::CleanupPolicyEx(false), HRESULT=ffffffff (e:\nts_sccm_release\sms\client\osdeployment\preparesmsclient\preparesmsclient.cpp,564)
pCmd->Execute(), HRESULT=ffffffff (e:\nts_sccm_release\sms\client\osdeployment\preparesmsclient\main.cpp,136)
Wmi query ‘select *from CCM_Policy where PolicySource = ‘CcmTaskSequence” failed, hr=0xffffffff
Failed to delete policies compiled by TaskSequence (0xffffffff)
Failed to prepare SMS Client for capture, hr=ffffffff
Failed to prepare SMS Client for capture, hr=ffffffff.

As I said in the introduction this error is a timeout. In my environments the step failed mostly after 5 minutes. The problem is the underlining WMI Provider and the very high count (65000+) of WMI Objects to delete.

The Solution

First I tried do delete the WMI Objects in PowerShell Script before the Prepare Configuration Manager Client Step with the following code:

Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig –query (“Select * from ccm_policy where PolicySource=’ccmtasksequence'”) | Remove-WmiObject

Still I got an error and also the script failed  … ErzürntNow I found the answer in the Technet Forums. The idea is the same as my first try. Anders Horgen posted is solution. So many thanks to him, he made my day Smiley.

$Policy = @(Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”))
$policy.Count | Out-File $Env:WinDir\CCM\Logs\OSD_PrePareConfigMgrClient.log -Append

Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”) | Remove-WmiObject

$RemainingPolicy = @(Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”))
$RemainingPolicy.Count | Out-File $Env:WinDir\CCM\Logs\OSD_PrePareConfigMgrClient.log –Append

Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”) | Remove-WmiObject

$RemainingPolicy = @(Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”))
$RemainingPolicy.Count | Out-File $Env:WinDir\CCM\Logs\OSD_PrePareConfigMgrClient.log –Append

Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”) | Remove-WmiObject

$RemainingPolicy = @(Get-WMIObject -Namespace root\ccm\policy\DefaultMachine\RequestedConfig -query(“Select * from ccm_policy where PolicySource=’ccmtasksequence'”))
$RemainingPolicy.Count | Out-File $Env:WinDir\CCM\Logs\OSD_PrePareConfigMgrClient.log –Append

If you look at the status message entries you will see, that the first query will end in an error, but that is not a problem. In the log file you will see that the count off policies decreases with every execution.

image

Follow me

0 Comments

Leave a Reply

Avatar placeholder

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

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