How to integrate updates into a VHD drive
using KUC

 

With VHD update installation, there is no way back. To get back to the initial state you have to make a backup first. Furthermore, all snapshots you may have taken are useless. From the time, you take a snapshot, all changes will be saved in a different file and not in the initial VHD. In other words: the VHD you attach has the state of the oldest snapshot you take. So cleanup all your snapshots before you continue. If you don’t want to do that, use ONLINE installation! 

 

1.      Locate you VHD file
set sourcefile=”C:\Virtual hard disks\WinClient-x86.vhd”

2.      Attach the VHD
diskpart
select vdisk file=%sourcefile%
attach vdisk
exit

3.      Determine the drive letter of the attached VHD
Just open the explorer and look; assume we got H:\

Note
To automate the process you could create four files, two answer file (attach_it.txt, detach_it.txt) and two commandlets (attach_vhd.cmd, detach_vhd.cmd).

attach_it.txt:
select vdisk file=%sourcefile%
attach vdisk
exit
attach_vhd.cmd:
set sourcefile=”C:\Virtual hard disks\WinClient-x86.vhd”
diskpart /s attach_it.txt

detach_it.txt:
select vdisk file=%sourcefile%
detach vdisk
exit
detach_vhd.cmd:
set sourcefile=”C:\Virtual hard disks\WinClient-x86.vhd”
diskpart /s detach_it.txt

If you only attach one VHD at a time the drive letter will always be the same.

Another way to attach the VHD is using the “Computer Management”:
right click “Disk Management”;
select Attach VHD;
select the VHD you like;
again I assume you got drive letter H:\

 

 

After you have attached the VHD, call KUC

 

KUC /VHD-drive:h:\ /up-dir:c:\wu /repo-dir:c:\wu\repo

 

Select the options you want and finish KUC.

In the c:\wu folder first call

Remove_old

Here we have the same situation as we got with DVD integration. (link)
It’s extremely important, that you remove all old packages before you add new once. During VHD update integration, it’s not possible to remove some kind of “superseded” packages.

If your VHD has version 1 of a package installed and you want to install version 2 and version 1 should be removed, you need to remove version 1 before you add version 2. If you work in the opposite, the removal of version 1 will fail.

KUC takes care of that.
It will not offer the addition of version 2 as long as version 1 is installed.
If both version 1 and version 2 are installed, KUC will remove both of them first before version 2 is added.

Furthermore, I noticed that there are also several updates that only can be removed, if other updates are removed first. Most of them are windows-win32k updates. The same mechanism you find during installation of updates, some packages only can be installed if other updates are installed first.
 

You may have to run the remover more than one time.

It’s up to you if you just run the remove_old command again or create a new fresh one with KUC after the first run finishes (recommended).

Now we have all old packages removed, we can start the updates process.

During running of KUC you have already downloaded all missing updates which are now located in the c:\wu\repo folder. In the next step, we populate the working folders with the updates that represent your needs. Just call

 

Copy_Files_2_add

 

Finally but yet importantly, we start the update process.

 

Update

 

After the update finishes, rerun KUC to check if there are some updates/features you oversaw or that could only be installed if others had been installed first.
Note: All updates that should be installed “online only” (DVD prohibited) will not be offered during the update process.
I the opposite of the DVD integration these updates will not be remove if they are found.

 
If all satisfies you needs and wishes, only one thing is left to do. You have to detach the VHD. Again, you have two opportunities to do that. Run the commandlet “detach_vhd.cmd” (see above) or use the “Computer Management”.

 

 

Useful Notes:

Disabling the virus scanner is a possibility but not necessary.

Do not try to add IE9 languages packs of a language that is not supported by the installed OS languages!
Dism will start the installation and result in Error: 0x800f0830: “The specified image is no longer serviceable.”
The only thing you can do is to restart the VM and make a repair / update installation of Windows.

The same result you get, if you try this online.

Use Windows update to show you the
If you have any problem with the installation or removal of a package, look inside the “packages_out.txt” file of KUC. There you may find the reason.
If you have to update only one VM, it makes no sense to use VHD update installation.

It’s more interesting if you have several VMs all with the same OS and the same update-state.

In this situation, you shut down all VMs, run KUC for one VHD, and use a batch to maintain one by one, then restart them all again.

Unfortunately that does not work with Server Core as main OS. In this situation, you could run KUC in one VM with the
/VHD-drive:C:\ switch to create the commandlets and download the missing updates; copy the content of c:\wu to the server core drive; shutdown the VMs; and start the process. Don’t forget to change the drive letter in the commandlets. 

 


 

KUC contains references to 10 different OS versions and their derivates.
Windows 7 x86 (Starter, Home, Home Premium, Professional, Ultimate, Enterprise)

Windows 7 x64 (Home, Home Premium, Professional, Ultimate, Enterprise)

Windows Server 2008 R2 (Standard, Enterprise, Data, Web)

Windows Server 2008 R2 server core (Standard, Enterprise, Data, Web)

Windows Multipoint Server 2011

Windows Home Server 2011

Windows Storage Server 2008 essentials

Windows Small Business Server 2011 essentials

Windows 7 Embedded x64 (as online and image version)

Windows 7 Embedded x86 (as online and image version)