Last year I wrote on automatically updating your Server Core. While a lot of people valued the information in that post, the information was rather unsatisfactory on the subject of manually updating Server Core installations of Windows Server 2008. Now is the time to correct this apparent omission. Read on!
Windows Update Script
Microsoft posted a script sample on the MSDN library roughly two months ago, named WUA_SearchDownloadInstall.vbs.
It searches for all the applicable software updates and then lists those updates. Next, it creates a collection of updates to download and then downloads them. Finally, it creates a collection of updates to install, asks them whether you would like to install them and then installs them. (or not) When done it will prompt to reboot when needed.
This is exactly what you’d do in the graphical Windows Update interface of a Full installation of Windows Server 2008 when you don’t want it to update automatically but instead want it to update during a planned maintenance window. With this script you can do it on the command prompt of your Server Core installation.
The only thing missing from this script is the ‘view update history’ option. This can be easily achieved by running the following command:
wmic qfe list /format:list | find “HotFixID”
You can find the contents of WUA_SearchDownloadInstall.vbs in the MSDN Library.
It’s right here. Copy the content and paste it inside Notepad. Save the file with the desired file name and file extension.
To get the file onto your Server Core box collect some hints here.
How to use it
To run the script type the following command:
It will look for updates and download them. When done it will ask whether you want to install the updates. Pressing Y , followed by an enter results in installing the updates, N and enter exists the script immediately.
When the system needs a reboot look for the Reboot Required text above the listing of updates installed and their individual installation results. When you need to reboot the box it will report True.
The script is a real lifesaver when you want to control the Windows Update behavior of your Server Core installation beyond the settings for Automatic Updates.
Greater control can be achieved by manually editing the sample script to prompt for individual download and install approval… but then Windows Server Update Services (WSUS) might also be what you want.
(Automatically) Updating Server Core
Getting installation files onto Server Core
Installing Updates on Server Core
Searching, Downloading, and Installing Updates
Searching, Downloading, and Installing Windows Updates
How to apply WSUS updates to a Windows Server 2008 Core machine
Tales from the Datacenter: Updating Windows Server 2008 Core