Create batch file for windows update feature image

How to Create Batchfile to install Windows update?

Windows Updates is Microsoft service that is used to keep the Microsoft Windows operating system and several other Microsoft programs updated in the form of service packs and patches. Updates often include feature enhancements and security updates to protect Windows from malware and malicious attacks. Windows Update can also be used to update drivers for popular hardware devices. Patches and other security updates are routinely released through Windows Update on the second Tuesday of every month it’s called Patch Tuesday. Usually, windows update is automatic, once the patches released windows will automatically download and install it, these automatic updates are controlled by windows automatic update.

In windows, 10 managing windows update are controlled by Windows update. Using this option users can control the automatic updates like pausing the updates, change the active hours, view update history, and Delivery Optimization. Windows Updates are very important and considered very mandatory in many corporate companies, even they set policy and add this under compliance parameter, even though the windows update is automatic not all the windows updates will install automatic sometimes some patches(KB updates) won’t install automatically. This article will guide you on how to download and install Windows Updates automatically by Creating a Batchfile to install Windows update.

Create Batchfile to install Windows update:

First Note down the KB number which you want to install, then you have to create a batch file to download the Windows patches from the Microsoft Update Catalog. Microsoft Update Catalog is a service from Microsoft that provides a listing of updates that can be distributed over a corporate network. You can use it as a one-stop location for finding Microsoft software updates, drivers, and hotfixes.

Open windows update catalog and search for the KB number which you want to download. And now choose the correct patches which is suitable for your system and operating system.

Choose the KB article

Click on the Download button, then you will get a Popup to download the package, right-click on the msu link and copy the link. And paste it accordingly in the below-mentioned script.

Copy link address and create Batchfile to install Windows update

Open Note pad and copy-paste the below-mentioned script.

@echo off
cd/
echo "Downloading Patches; This will take several minutes depends on your Internet speed"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://download.windowsupdate.com/c/msdownload/update/software/uprl/2020/03/windows-kb000000-x64-v5.81_74132082f1421c2217b1b07673b671ceddba20fb.exe', ' kb000000_Scan.exe')"
echo "1 out of 4 downloaded"
echo "****"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://download.windowsupdate.com/c/msdownload/update/software/secu/2020/03/windows10.0- kb000000-x64_5db6cfc57a8bda4d13107ad24b3fe8fd790219cf.msu', ' kb000000.msu')"
echo "2 out of 4 downloaded"
echo "****"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://download.windowsupdate.com/c/msdownload/update/software/secu/2020/04/windows10.0- kb000000-x64_705fda69935538eab5054d9d616e1761742816ec.msu', ' kb000000.msu')"
echo "3 out of 4 downloaded"
echo "****"
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://download.windowsupdate.com/d/msdownload/update/software/secu/2020/04/windows10.0- kb000000-x64_5411f88ea08bfc0ac98f388f5a3bdc8bcfea3261.msu', ' kb000000.msu')"
echo "4 out of 4 are downloaded, Now installing patches!"
echo "****"
@echo off
cd/
wusa.exe C:\ kb000000.msu /quiet /norestart
echo " kb000000 is installed, processing the next one"
echo "****"
wusa.exe C:\ kb000000.msu /quiet /norestart
echo " kb000000 is installed, processing the next one"
echo "****"
echo "This will take 5-10 mins for installing"
echo "****"
wusa.exe C:\ kb000000.msu /quiet /norestart
echo "All the patches are installed & Your system is about to restart now"
shutdown -r

Now the first part of the script downloads the Patches from the link which you have mentioned and the second part of the script installs the windows patches. Make sure the KB numbers and the msu link are replaced correctly as per your requirement.

And save the batch file as AutoUpdate.bat then copy and paste the file to the C drive and run in admin mode. This script will be really helpful if you are an IT administrator to install the patches in multiple systems.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top