need a script to deploy multiple windows updates

need a script to deploy multiple windows updates using a group policy.

1. I will place the following updates on a file share for example: \\192.168.1.100\updates\. I need a script or a batch file that I will publish using a group policy to deploy the updates on my windows 7 client computers. these updates are for windows 7 64 bit clients only.

2. the updates I want to install are like below located in the \\192.168.1.100\updates\ folder.

Windows6.1-KB2729094-v2-x64.msu
Windows6.1-KB2731771-x64.msu
Windows6.1-KB2533623-x64.msu
Windows6.1-KB2670838-x64.msu
Windows6.1-KB2786081-x64.msu
Windows6.1-KB2834140-v2-x64.msu
Windows6.1-KB2888049-x64.msu
Windows6.1-KB2882822-x64.msu
Windows6.1-KB2726535-x64.msu

3. I need a batch file that can trigger the deployment in sequence one after the other.
4. if the update is already installed it should skip and move to the next update.

there are some scripts I found but not working. appreciate any help
Aamer MAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobertSystem AdminCommented:
I assume you are in a small environment that you don't have a server that can run wsus (or something like SCCM) as using the update solutions is what I would normally recommend.

So to install updates you just use wusa.exe
you then point to the MSU file and provide parameters. (such as quiet or no restart)
If an update is already installed the updates will not reinstall when you run as below. (you can see same behavior by running one of the updates manually after a reboot, it will tell you the update is already installed)  

so an example
wusa.exe C:\temp\Windows6.1-KB2729094-v2-x64.msu /quiet /norestart 

Open in new window


Also be sure the process running the command has rights to the network path. (if you don't copy them local)
Aamer MAuthor Commented:
thanks for a reply.

yes this command that you suggested works but I have multiple updates in a folder and each should run after the previous is completed.

I tried this script below but the script waits for a specific time like in the script 3 sec and starts the second update. the first update may not finish in that time and is creating issues. I want the second update to start after the first one is completed
:
@echo off
for /f %%A in ('dir /b *.msu') do (
echo == Installing Updates == "%%A" ...
timeout /t 3
C:\Windows\system32\wusa.exe %%A /quiet /norestart
)
echo.
echo ########################################
echo.
echo == Updates installed ==
echo.
echo == Press any key to restart ==&pause>nul
echo.
shutdown.exe /r /t 0
RobertSystem AdminCommented:
You can try to add add "Start /Wait" before the command.
It should work but I haven't tried the below myself.

For example:
@echo off
for /f %%A in ('dir /b *.msu') do (
echo == Installing Updates == "%%A" ...
timeout /t 3
Start /wait C:\Windows\system32\wusa.exe %%A /quiet /norestart
)
echo.
echo ########################################
echo.
echo == Updates installed ==
echo.
echo == Press any key to restart ==&pause>nul
echo.
shutdown.exe /r /t 0 

Open in new window

Shaun VermaakTechnical SpecialistCommented:
Do not run it from the server. Every execution will trigger a full download of the MSU file, even after it was installed.

Copy the files to computers using GPO File Preferences
(example here) https://www.experts-exchange.com/articles/29126/Deploy-single-EXE-applications-without-installers.html
and run them locally with a GPO Schedule Task Preference
(example here) https://www.experts-exchange.com/articles/31687/Windows-Firewall-as-Code.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Updates

From novice to tech pro — start learning today.