Deploying Windows Updates through a batch file



Download the required windows update from Microsoft, there are different files for 32bit and 64bit


The following example is to deploy the March 2017 Windows Security Update Package 


Create a batch file for the 64bit Update


@ECHO OFF

mkdir c:\tmps

xcopy /Y \\192.168.200.66\Apps\kb-fix\Windows6.1-KB4012215-x64.msu c:\tmps

expand.exe -f:* "C:\tmps\Windows6.1-KB4012215-x64.msu" %TEMP%

pkgmgr.exe /quiet /n:%TEMP%\Windows6.1-KB4012215-x64.xml

rd c:\tmps /S /Q

exit



Create a batch file for the 32bit Update


@ECHO OFF

mkdir c:\tmps

xcopy /Y \\192.168.200.66\Apps\kb-fix\Windows6.1-KB4012215-x86.msu c:\tmps

expand -f:* "C:\tmps\Windows6.1-KB4012215-x86.msu" %TEMP%

pkgmgr.exe /quiet /n:%TEMP%\Windows6.1-KB4012215-x86.xml

rd c:\tmps /S /Q

exit