Hyper-V Quick Tips Uncategorized Windows Server

Applying updates (cab & msu) by batch file…

Another one from my toolkit..

Basically run this batch file from a folder with the required update files and it will install them all.

Once it is finished it will prompt for any input to restart the server.

Enjoy!
Dan

@ECHO OFF
 SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
 FOR /R "%~dp0" %%A IN (*-KB*.msu) DO (
 CALL :SUB %%~nA
 ECHO= Installing KB!KB_NUM!
 >NUL TIMEOUT /t 3
 WUSA "%%A" /quiet /norestart)
 ECHO= == Press any key to restart ==
 >NUL PAUSE
SHUTDOWN.EXE /r /t 0
 GOTO :EOF

:SUB
 SET "KB_NUM=%*"
FOR /F "DELIMS=-" %%B IN ("%KB_NUM:*-KB=%") DO SET "KB_NUM=%%B"

Leave a Reply