Jump to content
Sign in to follow this  

How to integrate KB2533552, KB3046269 and KB3177467 in Win7 offline

Recommended Posts

Here is the script I wrote for direct-integration of KB2533552 into your Windows 7 install:

@echo off
set KB2533552=%1

:: Figure out where the mounted Windows install is:
for /F "tokens=* USEBACKQ" %%F IN (`dism /get-mountedwiminfo | find "Mount Dir"`) DO (SET line=%%F)
set "MOUNT_DIR=%line:* : =%"

:: Extract the %temp%\KB2533552 package and patch it for DISM:
mkdir "%temp%\KB2533552"
expand -F:* "%KB2533552%" "%temp%\KB2533552"\
mkdir "%temp%\KB2533552\Unpacked"
expand -F:* "%temp%\KB2533552\Windows6.1-KB2533552-x64.cab" "%temp%\KB2533552\Unpacked"\
copy "%temp%\KB2533552\Unpacked\update.mum" "%temp%\KB2533552\Unpacked\update.mum.bak"

:: Use VBS to replace specific text inside of the "update.mum" file:
echo Const ForReading = 1 > ""%temp%\replace.vbs""
echo Const ForWriting = 2 >> "%temp%\replace.vbs"
echo. >> "%temp%\replace.vbs"
echo strFileName = Wscript.Arguments(0) >> "%temp%\replace.vbs"
echo strOldText = "exclusive=" + chr(34) + "true" + chr(34) +" allowedOffline=" + chr(34) + "false" + chr(34) >> "%temp%\replace.vbs"
echo strNewText = "exclusive=" + chr(34) + "false" + chr(34) +" allowedOffline=" + chr(34) + "true" + chr(34) >> "%temp%\replace.vbs"
echo. >> "%temp%\replace.vbs"
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >> "%temp%\replace.vbs"
echo Set objFile = objFSO.OpenTextFile(strFileName, ForReading) >> "%temp%\replace.vbs"
echo strText = objFile.ReadAll >> "%temp%\replace.vbs"
echo objFile.Close >> "%temp%\replace.vbs"
echo.  >> "%temp%\replace.vbs"
echo strNewText = Replace(strText, strOldText, strNewText) >> "%temp%\replace.vbs"
echo Set objFile = objFSO.OpenTextFile(strFileName, ForWriting) >> "%temp%\replace.vbs"
echo objFile.Write strNewText  'WriteLine adds extra CR/LF >> "%temp%\replace.vbs"
echo objFile.Close >> "%temp%\replace.vbs"
cscript "%temp%\replace.vbs" "%temp%\KB2533552\Unpacked\update.mum"

:: Integrate the patched version of %temp%\KB2533552 into Windows install:
dism /Add-Package /Image:"%MOUNT_DIR%" /PackagePath:"%temp%\KB2533552\Unpacked"

:: Now we need overwrite the modified "update.mum" with the original, so
:: that KB2533552 doesn't show up under Windows Update anymore....
set SRC="%temp%\KB2533552\"Original\update.mum.bak
set DST=%MOUNT_DIR%\Windows\servicing\Packages\Package_for_KB2533552~31bf3856ad364e35~amd64~~
takeown /F "%DST%" /A
icacls "%DST%" /grant Administrators:F
copy "%SRC%" "%DST%"
icacls "%DST%" /setowner "NT SERVICE\TrustedInstaller"
icacls "%DST%" /grant:r Administrators:RX

In order to use this script, you must invoke the script with the filename of the KB2533552 MSU file you are trying to integrate as a parameter to the script.  If it is not in the current directory (or calling direct from the Start Menu), you must also include the path to the MSU file.

Once KB2533552 is installed, KB3046269 can be easily installed using DISM (or WinToolkit).

The next patch, KB3177467, requires a bit more work to properly integrate, as described here (titled Issues After Integrating KB3177467):


I am trying to update my Windows 7 Deployment image with update KB3177467. Once I use DISM to add this update to my Windows 7 WIM, no further updates can be applied to the WIM. The error I see on the Command Prompt is:

An error occurred applying the Unattend.xml file from the .msu package.
For more information, review the log file. Error: 0x800f082f

The error in dism.log is:

Exec: Cannot finalize session because an exclusive session is pending. [HRESULT = 0x800f082f - CBS_E_EXCLUSIVE_WOULD_MERGE]

I tried this out with a fresh copy of the install.wim off of a MSDN ISO, integrating KB3177467, and then trying to integrate any other Windows Update. The same errors happen.


I took a further look into this issue. The error 0x800f082f seems to occur when the Registry entry HKLM\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\SessionsPending\Exclusive is not set to 0. For some reason, when integrating KB3177467 to a WIM, DISM leaves that Registry entry set to 3.

So I found this solution (titled KB3177467 Offline Integration Problem and Solution ), which requires the setacl tool (which can be downloaded from helgeklein.com).  Other versions may be available, however, I'm not sure where they might be....  But you must integrate KB3177467 first before executing these commands:

reg load HKLM\TempSoftware %MOUNT_DIR%\windows\system32\config\Software
setacl -on "HKLM\TempSoftware\Microsoft\Windows\CurrentVersion\Component Based Servicing\SessionsPending" -ot reg -actn setowner -ownr n:Administrators
setacl -on "HKLM\TempSoftware\Microsoft\Windows\CurrentVersion\Component Based Servicing\SessionsPending" -ot reg -actn ace -ace n:Administrators;p:full
reg add "HKLM\TempSoftware\Microsoft\Windows\CurrentVersion\Component Based Servicing\SessionsPending" /v Exclusive /t REG_DWORD /d 0 /f
reg unload HKLM\TempSoftware

Obviously you have to replace %MOUNT_DIR% with your mount path.

Hope this helps somebody!  Let me know if it doesn't work for you and I'll try to fix it!



Edited by dougiefresh2
Updated script, added KB3046269 and KB3177467

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...