Deploying VDI for RDS 2012 / 2012R2 – Part III – Updating a Pooled Desktop Image

Applies to: Windows Server 2012 and 2012 R2

Part III

In part II we saw how to deploy and publish a Windows 7 pooled virtual desktop. Now let’s take a look at the steps needed in making a change or update to our image and making it available to users. To recap our environment, we have a Windows 7 pooled desktop collection available to our users. This was created from our master virtual machine called Win7master. Part of the process needed when we created our collection was to run sysprep on our master image. As a good practice measure, I created a checkpoint of the virtual machine prior to running sysprep. This was done so I can easily revert the virtual machine back to a normal state prior to when I ran sys-prep.

Within the Hyper-V console, revert to the correct checkpoint.

1

2

Start the virtual machine.

3

Once the virtual machine is started, you can login and make your change(s) to the image. For this example, I am updating the Microsoft Office application to the latest version. Once I have completed the update of Microsoft Office and made all of my changes, we will need to run Sysprep again. Prior to running sysprep, let’s create a new checkpoint for the virtual machine so we have a checkpoint to come back to when we are ready to make our next update to the image.

4

It is also a good practice to rename the checkpoint to a name which references the update made.

5

6

Once the checkpoint is created and renamed, we can run sysprep. Within the Windows 7 virtual machine, launch sysprep located in: %windir%\system32\sysprep\sysprep.exe

7

You can also run the following command line:

Windows 7: %windir%\system32\sysprep\sysprep.exe /generalize /oobe /shutdown

Windows 8: %windir%\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /mode:vm

Once Sysprep is completed, it will shut down the virtual machine.

Now that our virtual machine is sys-prepped and ready, let’s go back to RDMS within Server Manager. Within RDMS, click on our Virtual Desktop Collection.

8

Under the Virtual Desktop section on the right, click on tasks and select the option “Recreate All Virtual Desktops”.

9

Once the Wizard initializes, we can select our virtual desktop template. Highlight the master virtual machine and hit next. (Win7Master)

10

On the User Logoff Policy screen, we are presented with a few options. These options will allow us to schedule the re-creation of our virtual desktops. The first option will begin recreating any desktops which have no users currently connected. However, any users who are connected, the re-creation will not occur until they logoff. If the user doesn’t logoff, we can set a time frame which will force the re-creation of the desktop regardless if the user is logged in. So based on the following schedule, if the user is logged in between the dates listed, they will be automatically logged off and the desktop will be recreated using the latest update to our master virtual image.

11

The other option will allow us to force a specific time to recreate all the desktops regardless if a user is logged in or not. You can set it to perform the re-creation right away, or pick a specific time to start the re-creation. This is good in the event users were logged in. You would have to ability to schedule the re-creation during non-business hours so users are not disrupted. Since I currently do not have any users logged in, we will schedule the re-creation to occur now. Select “Recreate virtual desktops now and log off all users” and hit next.

12

On the confirmation screen, confirm the options selected and hit Create.

4-21-2014 6-37-43 PM

During the creation process, the process of exporting the virtual desktop template will begin. Once this is completed, the virtual desktops will be recreated based off the virtual desktop template.

13

After the virtual desktop template is exported, the option of closing the wizard is available. You can close out of the wizard and let the process run in the background. If you wish to come back and view the progress of the desktop re-creation, you can go back to the virtual desktop collection within RDMS and under the virtual desktop section, click on tasks and select “Task Status Details”.

14

15

16

During the re-creation of the virtual desktops, the actual virtual machines will be deleted and recreated from the RD Virtualization Host. After they are recreated, the machines will boot up and go through the sysprep process. This will use the settings configured for sysprep which were done during the creation of the virtual desktop collection. You can witness this process as it is happens. Here I am connected to the console of one of the virtual desktops Win7-2. Since I am connected to the console of the virtual desktop, when the virtual machine is deleted, Hyper-V will send a pop-up stating the machine was deleted.

17

After a few seconds, the machine will reappear back in the Hyper-V console. Within the Hyper-V console, reconnect to the newly recreated virtual machine.

18

Here we can see the virtual desktop is going through the sys-prep process.

19

Once the virtual desktops are finished with the re-creation process, users will be able to connect to the updated virtual desktops.

20

Here is a quick rundown of the re-creation process:

  1. Make the necessary changes and updates to the master desktop image.
  2. Create a new checkpoint once all changes and updates are made.
  3. Run sysprep on the master virtual image with the following options:

Windows 7: %windir%\system32\sysprep\sysprep.exe /generalize /oobe /shutdown

Windows 8: %windir%\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /mode:vm

  1. Once sysprep is completed, go to RDMS and within the Virtual Desktop collection select the action to recreate all desktops.
  2. Choose the virtual desktop template
  3. Schedule the desktop re-creation
  4. Recreate the virtual desktops

© 2014 Eddie Kwasnik “the Wolf” All Rights Reserved

, , , , , , , ,

  1. #1 by Marcel on July 24, 2014 - 4:29 am

    Very good manual! Makes it easy for someone like me who had to do this for the first time… Thanks!

  2. #2 by John Butler on August 29, 2014 - 2:53 am

    Hello, what sort of collection sizes have people being using? Has anyone found it useful to have multiple identical collections for performance or management issues? Thanks John

  3. #3 by Carl M. on December 11, 2014 - 11:02 pm

    This is an amazing tutorial which demystifies VDI! Thank you so much for taking the time to publish it. I wish the TechNet articles were at least half as informative.

  4. #5 by Lynton on December 16, 2015 - 10:43 am

    Well done, great tutorial!!
    We’re running Server 2012 and having trouble getting the rollback of the VM’s to work. We have a pooled virtual desktop collection with rollback enabled but it simply doesn’t happen. Everything else about the virtual desktops works perfectly.
    We have 1xBroker, 3xRDHost servers, 2xSessionHost and a web frontend all on separate servers.

    Any ideas?
    What logs can I check?
    Technically how does the rollback work, that might give me a clue?

    Kind Regards

    Lynton

  5. #6 by Terry on January 19, 2016 - 4:56 am

    Thanks for all your articles Eddie, your elegant work puts MS to shame!

  6. #7 by balazs on February 17, 2016 - 10:37 am

    very userful tutorial. Thank you for sharing.

  7. #8 by Marco on January 19, 2017 - 6:50 am

    Hi, My name is Marco.

    I receive the following error when the template is exported.

    “The request to recreate the virtual desktop in ‘collection name’ failed with the following errors:

    Could not export the virtual desktop template ‘template name’. Exception of type ‘Microsoft.RemoteDesktopServices.Common.RDManagementException’ was thrown”

    Any help will be much appreciated.

    Kind Regards.

Leave a reply to Lynton Cancel reply