Offline servicing of a VHD or WIM file

I came across a nifty PowerShell module today. The Module can be found here: http://windowsitpro.com/windows/add-updates-offline-vhd-or-wim-file

It’s an automation of the offline servicing of a VHD(X) or WIM file.

If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$Arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $Arguments
Break
}

Import-Module C:\Install-Patch.psm1
Install-Patch <Path/share to vhdx file> "<Path/Share to SCCM/WSUS Windows 2012 updates>"

This script I put in my task scheduler to run weekly, specifying the location of my VHDX file which I use to deploy servers from… This way my main VHD file always contains the latest updates when I deploy a new server from this VHD.

The script will first check if it has been ran as administrator, if not, it’ll restart the script and execute and apply all updates the system doesn’t contain (yet) and uses your SCCM/WSUS share (thus automatically uses its settings and rules for update deployment)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: