How to: Install Multiple Windows Updates and/or Hotfixes in a Time

How to: Install Multiple Windows Updates and/or Hotfixes in a Time

Time to time you need to install multiple Windows Update or Hotfix files on a given computer or server. This can happen if you deploy a new server that needs a bunch of hotfixes that are not available from WSUS and/or Microsoft Update. Or when you're installing an isolated secure workstation that should be never connected to any network.

Here's a simple batch file that automates this task. All it does is looking for potential applicable update files and running them.
Features
  • Looks for hotfixes in the same folder where the script resides.
  • Works with Windows Vista and higher.
  • Works with x86 (aka i386 aka 32-bit) and x64 (aka EM64T aka AMD64 aka 64-bit) architectures.
  • Works over network. There's no need copy update files locally.
  • Works with subfoldrs. You can group hotfix files under several subfolders to ease manual installations.
Logging
Currently, to evaluate success or failure of installing individual update you need to look for error code. The reason for this is that own logs of “Windows Update Standalone Installer” (WUSA) are human-unreadable binary files.

To evaluate error code you first need to convert it from Decimal (as output by wusa.exe) to Hex. Then look up that Hex value in the list of Windows Update Agent Result Codes.

It might be possible to automate error code lookup but this is not implemented in current version of the script.
@echo off
cls

if %PROCESSOR_ARCHITECTURE%==x86 set arch=x86
if %PROCESSOR_ARCHITECTURE%==AMD64 set arch=x64
for /F "tokens=4-5 delims=[.] " %%A in ('ver') do set ver=%%A.%%B
set log="%temp%\wusa-%date:~-4,4%%date:~-7,2%%date:~-10,2%-%time:~-11,2%%time:~-8,2%%time:~-5,2%.log"

echo.
echo Installing updates from "%~dp0"
echo.

for /r "%~dp0" %%m in ("Windows%ver%*%arch%*.msu") do (
set msupath=%%m
set msufile=%%~nm
call :wusa
)
echo.
echo Done! Please check %log% for results.
echo.
pause
goto :eof

:wusa
echo %msufile%
start /wait "%SystemRoot%\System32\wusa.exe" "%msupath%" /quiet /norestart
echo %msufile% %errorlevel% >> %log%
Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Great. I was trying to find where's the reference for updates folder, but running it I discovered that the batch file must be where the updates are.

  • Hi,

    There is any specific procedure we need to follow to use this batch file to install hot fixes., because i have tried to use this to install  hot fix for august 2013 in win2K8 R2 and windows 7 machines ( x 64 bit) where it is failing to install the Hotfix in the same folder. though i have got the success message in the command prompt, the hot fix not installed and i couldn't able to trace the root cause as there is no logfile generated and no event recorded in event viewer.Can you please help me in this regard.

  • Hi,

    There is any specific procedure we need to follow to use this batch file to install hot fixes., because i have tried to use this to install  hot fix for august 2013 in win2K8 R2 and windows 7 machines ( x 64 bit) where it is failing to install the Hot fix in the same folder. though i have got the success message in the command prompt, the hot fix not installed and i couldn't able to trace the root cause as there is no log file generated and no event recorded in event viewer.Can you please help me in this regard.

  • Hi,

    There is any specific procedure we need to follow to use this batch file to install hot fixes., because i have tried to use this to install  hot fix for august 2013 in win2K8 R2 and windows 7 machines ( x 64 bit) where it is failing to install the Hot fix in the same folder. though i have got the success message in the command prompt, the hot fix not installed and i couldn't able to trace the root cause as there is no log file generated and no event recorded in event viewer.Can you please help me in this regard.

  • Maheshkumar S Tiwari edited Original. Comment: Added tags

Page 1 of 1 (5 items)