vSphere 5.1 VMware Tools Upgrade on XenDesktop Streamed VM (PVS 6.1) - Part I

Intro

Part of my job as Lab Manager is something that Sysadmins across the world have to deal with - routine maintenance. It's been a while since we rolled out vSphere 5.1 in the lab and we just upgraded our hosts to  so I figured it was about time to start patching VMware Tools on all of our guests. One of the tricker upgrades is the vDisk we use to boot our XenDesktop VMs via Citrix Provisioning Server. Here is a quick guide on how I did things after some trial and error, be aware there are other ways to get this done, such as cloning the VHD and booting it with Hyper-V then doing the upgrade that way.

So what's the problem, why cant we just upgrade the normal way? The problem lies in the way that Provisioning Server works. Here is an eDoc
The solution is pretty straight forward, but as with all things Provisioning Server, has to be done in a specific sequence or it will fail. So here are the steps, if anything here needs further explanation check out .

This blog post is going to be a long one so it'll probably be 2 Parts:

Part I Convert your VHD back to a VMDK

this eDocIn order to run Citrix's convert utility, you need to do one of two things: Copy your VHD and boot to the new VHD in single user mode, or take an outage and put your current VHD in single user mode. I opted for the latter.
First we copy all of our VHD files from your store in to a new location. In the screenshot below I grabbed all of the files for my base disk and it's versions and moved them into the UpdatedBaseFolder. We don't need the LOK files which are unnecessary because the disk won't have any locks on it after we rename and import it.

Next we rename all of the files, here's a handy PowerShell snippet that will rename all the files in the current working folder and append a string to the front of them, make sure you run it from the correct folder: 
gci | % {Rename-Item $ ("New_" + $_.name)}_Next we need to export the XML file that Provisioning Server uses to import the VHD, when you do this be sure to choose whatever version of the vDisk you want to be working with.  Then we open the XML file (it's in your store directory) in notepad and do a find replace all, changing the name of our original VHD to name to the new VHD, then rename the XML file itself to correspond to the name of the new VHD. Lastly, move all of your newly named VHD files out of the folder you created and back into the root directory of the store (use cut/paste it's faster since it doesn't actually move any data). Ignore the LOK files in my last screenshot here, they are there because I am already using my new vDisk, you shouldn't have any for your new vDisk at this point.




At this point, you should have all of your renamed vDisk files, as well as the renamed and altered XML export file from Provisioning Server in the root of your store directory. Now we can go into Provisioning Server and import the new vDisk, right click on your vDisk pool and choose Add or Import Existing vDisk.

In the window that appears, click Search, then select your new vDisk and click Add, if it is a single standalone vDisk you don't need to load balance option checked.We then assign the vDisk to our maintenance VM, you may want to remove an existing vDisk from the VM but you don't have to since maintenance VMs usually give you a boot menu when you PXE boot them.

Make sure that your Maintenance VM is set to boot from vDisk.

Then boot that sucker in vSphere, make sure the PXE boot gives you the option of booting to the new vDisk and not its old production vDisk.

Now we need to add a VDMK for the convert tool to use as a target. You can't add this thing until after the OS is up and I don't know why, Provisioning Server just wants things done it's way. Make sure it is big enough to hold the vDisk, I usually just make it the same size as my vDisk for the sake of ease. I also thick provision it so that VMware isn't having to expand the thing during the imaging process.

Now we have to initialize the disk, create a NTFS partition, and set this partition as active. Citrix also mentions having to delete boot.ini off of the thing, but I didn't see it there and the imaging tool has the option to scrub the partition first so you should be good. This is all done in Disk Management within Windows.




Verify your new disk shows up in My Computer and that you can browse to it, then browse to C:\Program Files\Citrix\Provisioning Services and run BNImage.exe. Click browse and select your new drive as the destination drive.

If all goes well, click Build, acknowledge the warning, and the conversion should start!

Once complete, shut down your VM, and head over to Provisioning Server, set the VM to boot from its Hard Disk rather than from the vDisk, then boot it again.


When it boots, PXE will still prompt to select a vDisk, but you should see that that the Hard Disk is the primary boot volume from within Windows and that the vDisk is attached as a secondary disk. If this is the case, you have successfully reverse imaged the vDisk.

That's it! In part II I will cover upgrading VMware tools and moving the image back to PVS in order to allow your VDI VMs to boot to the new image. Thanks for reading!

Build 1021289