[fixed] WMI Corruption During OSD Captures Causes SCCM Install Package TS Actions to Hang

UPDATE! I found an easier workaround. See my other post on the issue.

I’ve had this long running problem with SCCM 2012 that was threatening to make me go bald. I would run a Build and Capture to get a blank Windows 7 image with all Windows updates. This would work great and produce a viable WIM. However, when I tried to use that WIM for another build and capture, no packages would install. The TS action would just hang, and the logs would show that the package install was waiting for a status update.

It turns out that this behavior is caused by three issues: WMI corruption caused by the B&C process, issues with SCCM client behavior which are resolved in CU2, and known-issues with WMI after any Windows 7 SP1 install (slipstreamed or not).

The Fix

Three Parts

  1. Hotfixes during Build and Capture
  2. WMI Repair Script after every install
  3. SCCM CU2 installed as part of OSD.


Add the following Windows 7 Post-SP1 WMI hotfixes to your OSD process. I know this is a pain.

  • KB2617858 – Unexpectedly slow startup or logon process in Windows Server 2008 R2 or in Windows 7
  • KB2639505 – Loaded user profiles cannot be unloaded after you run WMI queries for the Win32_StartupCommand class in Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2
  • KB2547244 – The WMI service and the WMI providers stop responding when you use WMI performance classes to monitor performance on a computer that is running Windows 7 or Windows Server 2008 R2
  • KB2639077 – Handle leak in Svchost.exe when a WMI query is triggered by using the Win32_PowerSettingCapabilities class in Windows 7 or in Windows Server 2008 R2
  • KB982293 – The Svchost.exe process that has the WMI service crashes in Windows Server 2008 R2 or in Windows 7
  • KB2465990 – “0x80041002 (WBEM_E_NOT_FOUND)” error occurs when you try to open a WMI namespace on a computer that is running Windows 7 or Windows Server 2008 R2
  • KB2492536 – Msinfo32.exe takes a long time to display or export system information on a computer that has many MSI-X-supported devices and that is running Windows 7 or Windows Server 2008 R2
  • KB2692929 – “0x80041001” error when the Win32_Environment WMI class is queried by multiple requestors in Windows 7 or in Windows Server 2008 R2
  • KB2705357 – The WMI process stops sending events to WMI clients from a Windows 7-based or Windows Server 2008 R2-based server

Here’s my install script. It will install all .msu hotfixes in the folder.

@ECHO Installing all hotfixes in the folder %~dp0.
@ECHO Do not close this window. It will close when finished.
for /f "usebackq delims=|" %%f in (`dir /b "%~dp0*.msu"`) do wusa.exe %~dp0%%f /quiet /norestart

exit 0

WMI Repair Script

The following script repairs a known-issue with WMI directly after a Windows 1 SP1 install. The details are documented in the following KB by microsoft: KB2545227 – Event ID 10 is logged in the Application log after you install Service Pack 1 for Windows 7 or Windows Server 2008 R2.

The script language is vbscript. Save it as repair-wmi-win7p1.vbs, put it in a package, and call it with a task sequence ‘Run Command Line’ action directly after the ‘Setup Windows and ConfigMgr’ step.

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\subscription")

Set obj1 = objWMIService.ExecQuery("select * from __eventfilter where name='BVTFilter' and query='SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA ""Win32_Processor"" AND TargetInstance.LoadPercentage > 99'")
For Each obj1elem in obj1
	set obj2set = obj1elem.Associators_("__FilterToConsumerBinding")
	set obj3set = obj1elem.References_("__FilterToConsumerBinding")
	For each obj2 in obj2set
		WScript.echo "Deleting the object"
		WScript.echo obj2.GetObjectText_

	For Each obj3 in obj3set
		WScript.echo "Deleting the object"
		WScript.echo obj3.GetObjectText_

	WScript.echo "Deleting the object"
	WScript.echo obj1elem.GetObjectText_

SCCM CU2 OSD Install

On your ‘Setup Windows and ConfigMgr’ TS action on all task sequences, add the following parameter. You will need to change ADM00002 to match the package ID of the SCCM client install package. Also, it’s important to make sure that the package contains the CU2 hotfix. To make sure, navigate to the package’s source folder. You can add the hotfix manually, then redistribute the package to the distribution points. It’s also important to use the correct architecture.


That’s it! Packages install properly for me again during OSD. It took exactly how long you’d expect to figure all this out… 😦


4 thoughts on “[fixed] WMI Corruption During OSD Captures Causes SCCM Install Package TS Actions to Hang

  1. Pingback: [SCCM 2012] Task Sequence Hangs on Install Package During OSD (part 2) | windowsmasher

  2. Pingback: Table of Contents | windowsmasher

  3. Pingback: How To Fix 0x80041002 Not Found Errors - Windows Vista, Windows 7 & 8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s