<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Automatically updating a new windows installation - scripted

Published on
15,333 Points
6,133 Views
2 Endorsements
Last Modified:
Approved

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting and installing the next updates is not automated.


So that is what this tutorial is about: a script that automates this process, hands and worry free.

To script it, I am not going to use the built-in-windows wuauclt.exe. Although wuauclt has parameters for detection and installation, it is far less practical to use in this case (updating a newly installed computer), just think about how you should determine when to restart... Hence this tutorial.


My script relies on WUInstall.exe which is availabe as a free trial: http://wuinstall.com/index.php/en/free

In short, wuinstall.exe detects, downloads and installs updates using the internal windows mechanisms, it only extends the capabilities.


Prerequisites: Setup your WSUS server and tell the clients about it.

So first, we download wuinstall.exe (included in https://web.archive.org/web/20151227002916/http://www.hs2n.at/component/docman/doc_download/11-wuinstall-11-32-bit as well, which is not a trial, but even a full version, which you may use commercially) and we copy it to a certain path, I will use c:\windows. Now create a .bat file with the following content, save it, and use task scheduler to start it using the following parameters:

Executing user: system (password to be left blank)

trigger: at system startup

Task name: wuinstall


 

wuinstall /install
if %errorlevel% EQU 10 goto reboot
if %errorlevel% EQU 2 (goto done) ELSE msg * Something went wrong... please run wuinstall /install interactively
goto end
:reboot
shutdown -f -r -t 00
goto end
:done
msg * Updating completed!
schtasks /delete /tn WUInstall /f
:end


The script will search for updates and install those and afterwards reboot the computer and start over at next logon until now updates are left. You will be informed by popup if updating is completed or if something went wrong. WUInstall has many more parameters, however most of those are exclusive to the pro version which is not free. For example, you can decide not to install everything your own WSUS offers but only patches with severity critical or drivers only. http://wuinstall.com/images/folder/WuInstall_on1page_free.pdf tells you on one page what options you have with the free version and what features would require going pro.

.

2
Comment
Author:McKnife
2 Comments

Expert Comment

by:IT Guy
Do these commands work with Server 2016?
0
LVL 62

Author Comment

by:McKnife
Yes, they do.
0

Featured Post

Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Join & Write a Comment

This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month