Earlier this month, I published an article here on using PowerShell to perform offline servicing of Windows Updates for a set of VM templates. After publishing the original article, I received a couple of inquiries for extending that PowerShell script to not only apply Windows Updates to offline VM templates, but to also automate the process of first downloading Windows Updates. In doing so, this accelerates the process for downloading new updates each month and also reduces the chance of human error in not downloading all needed updates.
As it turns out, Alexander Krause from Leibniz Universität Hannover in Germany has already done a lot of the “heavy-lifting” for us in automating this process with a PowerShell module that he released on the TechNet Script Center earlier this year. In this article, I’ll step through the process of using Alexander’s module to automate the downloading of updates for Windows Server 2012 VM templates.
To use the Microsoft Updates Downloader PowerShell Module to perform automated downloads of Windows Updates as part of your offline VM template servicing script, you can use these steps:
When running the Invoke-Update function above, be sure to change the parameter values to reflect the appropriate Year, Month, ProductFamily and Product values for which you wish to download updates. Inside the downloaded PowerShell module, you’ll find that Alexander has already documented the standard names for each ProductFamily and Product value for reference purposes.
After the Invoke-Update function completes, you'll find that it built a set of folders inside the folder path specified in the $updatePath variable using the folder structure $updatePath\ProductFamily\Product based on the parameter values specified in the original command line. Inside the Product folder, you'll find the related MSU and CAB update files, waiting to be applied to your VM templates using the remainder of the script from my original article.
Do you have other approaches that you are using to service and apply updates to your VM templates? If so, please feel free to share your thoughts, ideas and feedback in the Comments area below!
Be sure to check out these additional resources:
Keith Mayer is a Senior Technical Evangelist at Microsoft, focused on helping ISV partners leverage the Azure cloud platform. Keith has over 20 years of experience as a technical leader of complex IT projects, in diverse roles, such as Network Engineer, IT Manager, Technical Instructor and Consultant. He has consulted and trained thousands of customers and partners worldwide on design of enterprise technology solutions.
Keith is currently certified on several Microsoft technologies, including Private Cloud, System Center, Hyper-V, Windows, Windows Server, SharePoint and Exchange. He also holds other industry certifications from VMware, IBM, Cisco, Citrix, HP, CheckPoint, CompTIA and Interwoven.
You can contact Keith online at http://aka.ms/AskKeith.