Single Image Management for Virtual Desktop Collections in Windows Server 2012

Single Image Management for Virtual Desktop Collections in Windows Server 2012

Rate This
  • Comments 25

Hi All,

My name is Ajay Kumar and I am a developer on the Remote Desktop Virtualization (RDV) team. In Windows Server 2012 (WS2012) we introduced a new feature for VDI deployments, which allows admins to automatically create multiple virtual machines (VMs) using a single image as input and deploy them as a virtual desktop collection. These virtual desktop collections, where VMs are automatically created by Remote Desktop Services (RDS) are referred to as managed virtual desktop collections.

In a previous blog post my colleague Omair Gillani has already demonstrated how an admin can create a Remote Desktop Services deployment and a managed virtual desktop collection using Windows PowerShell. In this blog post I will share some more details about managed virtual desktop collections and how an admin can use single Master VM to create and update hundreds of VMs in a managed virtual desktop collection (Single Image Management).

Master (Gold) VM in Managed Virtual Desktop Collections

A Master or Gold VM is formally referred to as “virtual desktop template” in the WS2012 Server Manager UI console and the cmdlets in Remote Desktop Services module for Windows PowerShell. It is an input to the managed virtual desktop collection creation process that allows an admin to manage a virtual desktop collection. The Master VM is created and managed by the admin and it specifies the hardware properties and software contents of all the automatically created VMs in that managed virtual desktop collection. For example, if the master VM is assigned 2GB of RAM, then each of the automatically created VMs in the managed virtual desktop collection will be assigned 2GB RAM.

In this section, I will describe the various supported options and requirements for the Master VM.

  1. Virtual Hard Disk
    1. The Master VM can only have one virtual hard disk (VHD) attached to it; more than one VHD attached to the Master VM is not supported.
    2. The VHD attached to the Master VM must have either a Windows 7 SP1 or Windows 8 image in sysprep generalized state.
    3. A diff disk chain attached to the Master VM as its VHD is supported.
    4. Although the VHD can have more than one logical partition defined in it, it can have only one Windows OS image installed in it.
  2. Memory: If the Master VM is configured with static memory, it must have at least 1024 MB as startup RAM. If the Master VM is configured with dynamic memory, the maximum RAM must be at least 1024 MB.
  3. Network: The Master VM must have a network adapter connected to a virtual switch on the hyper-V server.
  4. Snapshots on Master VM: A Master VM can have one or more snapshots. If there are multiple snapshots created on the Master VM, the current ("Now") state of the VM will be used to automatically create the VMs in a managed collection. This allows admins to manage the Master VM more efficiently. For example, an admin can take snapshot on the Master just before running sysprep generalize command and after the sysprep is complete, the Master VM can be used for creating a managed virtual desktop collection.
  5. Domain connectivity: Since the VMs in a managed collection are automatically joined to the specified domain, admins must ensure that the domain controller is reachable through the virtual switches on all the hyper-V servers.
  6. Export: During the managed virtual desktop collection creation process, the first step that Remote Desktop Services takes is to export the Master VM. This export process creates a copy of the Master VM's current h/w settings and the VHD attached to the Master VM at the admin specified storage location. The automatically created VMs and the VHDs attached to these VMs are based upon this copy of the Master VM. The original Master VM is never modified by Remote Desktop Services. Once the export process is complete, admin can continue using it.
  7. Two or more collections can share a Master VM. Each time a new collection is created or updated, the Master VM is exported again. So each managed collection has its own copy of a Master VM.

Rolling Out Updates to a Pooled Virtual Desktop Collection

To automatically update all the VMs in a pooled virtual desktop collection, the admin has to first apply the desired changes to the Master VM manually (for example, increase RAM from 1GB to 2GB or apply a software patch). Once the Master VM has been updated the admin can use either WS2012 Server Manager console or Windows PowerShell to push the updates to all the VMs in a pooled managed collection.

To update the VMs in a pooled virtual desktop collection using the WS2012 Server Manager console please follow these steps:

  1. Log on to the connection broker server as a domain user account which is also an admin on the connection broker server. Server Manager will start automatically. If it does not automatically start, click Start, type servermanager.exe, and then click Server Manager.
  2. In the left pane, click Remote Desktop Services, and then click Collections.
  3. Select the collection node to which you wish to roll out the update
  4. Click Tasks on Virtual Desktops list view, and then click Recreate All Virtual Desktops. This will launch the Recreate All Virtual Desktops wizard.
  5. Select the updated Master VM that you want to use to roll out the updates and click Next.
  6. Specify the User Logoff Policy and click Next.
  7. On the Confirmation page, click Create.

Here is an example of the Update-RDVirtualDesktopCollection cmdlet which can also be used to push updates to the VMs in a managed pooled virtual desktop collection:

PS C:\> import-module RemoteDesktop
PS C:\> $time = Get-Date 
PS C:\> Update-RDVirtualDesktopCollection -CollectionName MyPooledCollection -VirtualDesktopTemplateName masterVm -VirtualDesktopTemplateHostServer Host1.contoso.com -StartTime $time.AddDays(1) -ForceLogoffTime $time.AddDays(2)

During the update process, The Master VM is exported again and a new Master VM copy is created on the collection storage. All the VMs in the managed pooled virtual desktop collection are recreated by the Remote Desktop Services using the newer copy of the Master VM. Once the update process is complete and all the VMs in the collections have been successfully recreated, the Remote Desktop Services delete the old copy of the Master VM from the storage.

I would like to clarify that although a Master VM can be used to automatically create VMs in both types of collections (pooled and personal virtual desktop collections) but it can be used to update only the pooled virtual desktop collection VMs. Master VM cannot be used to push updates to existing VMs in a personal virtual desktop collection.

User Session Aware Update

The update process for managed pooled virtual desktop collection provides three options to the admin to decide when\how the updates will be applied to a managed pooled virtual desktop collection:

  1. Apply update gracefully in a time period
  2. Apply update forcefully now
  3. Apply update forcefully at a schedule time

If an admin selects the option a) and provides a time period, the update process for pooled virtual desktop becomes aware of the active user sessions on the VMs in the pooled virtual desktop collection. Only the unused VMs are updated during this time period. If a user logs off on his own before the end of the admin specified time period, the VM will be automatically queued up for the update process. At the end of the time period the users, which are still active on non-updated VMs, are forcefully logged off from the non-updated VMs and the update process for these remaining VMs will start.

All the VMs (updated\non-updated) in the collection are available for the user connections during this time period, except for the VMs on which update is in-progress.

In the previous section I have already given a PowerShell example for the option a). Here is a PowerShell example for the option b), which starts updating the VMs in the collection forcefully as soon as the Update-RDVirtualDesktopCollection cmdlet is executed:

PS C:\> import-module RemoteDesktop 
PS C:\> Update-RDVirtualDesktopCollection -CollectionName MyPooledCollection -VirtualDesktopTemplateName masterVm -VirtualDesktopTemplateHostServer Host1.contoso.com

Here is a PowerShell example for the option c), which starts updating the VMs in the collection forcefully at the specified time:

PS C:\> import-module RemoteDesktop 
PS C:\> $time = Get-Date 
PS C:\> Update-RDVirtualDesktopCollection -CollectionName MyPooledCollection -VirtualDesktopTemplateName masterVm -VirtualDesktopTemplateHostServer Host1.contoso.com -ForceLogoffTime $time.AddDays(2)

In all of the three examples above, the input values of cmdlet parameters -CollectionName, -VirtualDesktopTemplateName and –VirtualDesktopTemplateHostServer represent the variables that are specific to a deployment.

  • “MyCollectionName” is the name of the virtual desktop collection to which updates will be applied.
  • “masterVm” is the name of the Master VM which contains the updates.
  • “Host1.contoso.com” is the name of the hyper-V server that is hosting the Master VM named “masterVm”.

While trying these example cmdlets, please replace these names with the appropriate values in your deployment.

Summary

To summarize, the managed virtual desktop collections in WS2012 make it really easy for the admin to create and manage hundreds of VMs using a single Master VM as the template. In this blog post I have tried to describe the role of a Master VM in a managed virtual desktop collection and the supported options for a Master VM. I have also described how an admin can use Master VM to roll out updates to managed pooled virtual desktop collections. I hope you will find it useful while creating and updating VMs in your managed virtual desktop collections.

Looking forward to your questions and feedback,

-AJ

Leave a Comment
  • Please add 2 and 6 and type the answer here:
  • Post
  • Great post, thank you. I do have one issue I'd like to share and have your thoughts. When I launch "recreate all virtual desktops", it eventually fails with the error "active directory computer objects requested for virtual machine already exists". I was able to "bypass" this error by manually deleting the computer objects in AD. But this is not a viable solution since I need to automate the update process as I have 50+ VM insisde a pooled collection which I will have to update on a regular basis. Am I doing something wrong?

  • @Sam:

    If you are using a Managed Pooled Virtual Desktop Collection with a Central Storage (e.g. CSV\SAN or SMB), then the actual IO hit happens on the exported copy of the master image. After the export of the Master Image is complete, admin can continue to make changes to the master image.

    @Fred9777:

    By default Connection Manager does not "overwrite" existing AD machine accounts. If you are sure that the existing AD machine accounts that Connection Manager is complaining about, are not in use, you can run the powershell cmdlet given below (from RemoteDesktop powershell module) 'once' on the Connection Manager. After this cmdlet is run, Connection Manager will not complain about existing AD machine accounts and simply overwrite them in AD so that they could be used with new VMs in the collection. You must run this cmdlet as Connection Manager Admin.

    Cmdlet: Enable-RDVirtualDesktopADMachineAccountReuse

    Documentation: technet.microsoft.com/.../jj215455.aspx

  • How to create a Pooled VDI infrastructure using Win server 2012 as VM image?

    Is there a way to substitute win7/8 by winserver2012datacenter in point 1.b

    I have followed the "usual" way to build a pooled VDI desktop using Win7 or Win8 with success, but it fails when I use an image of Win Server 2012 as VM instead.

    Am I overlooking something?  Should I need to prepare the image in a different way? (Sysprep differently?)

    Thanks

  • How to create a Pooled VDI infrastructure using Win server 2012 as VM image?

    Is there a way to substitute win7/8 by winserver2012datacenter in point 1.b

    I have followed the "usual" way to build a pooled VDI desktop using Win7 or Win8 with success, but it fails when I use an image of Win Server 2012 as VM instead.

    Am I overlooking something?  Should I need to prepare the image in a different way? (Sysprep differently?)

    Thanks

  • Is it possible to have two different collections (for the purpose of having pools in two different geographic locations) and still use the same single master image to update the managed pool?

    And is it possible to have to connection brokers, one for each geographic location, but still controlling the same farm?

  • Hi Ajay,

    Your blog explains the whole VDI aspect of Windows Server 2012. I would appreciate if you could answer my query. I have deployed RDS and VDI(both Pooled and Personal Collection) in the past. I am currently working on a similiar scenario where in I have installed RDS Server role on a Windows Server 2012 R2 VM running inside my 64 GB Windows Server 2012 R2 Server. All the roles-RDCB, RDWA and RD Virtualization Host are hosted on the same Server. I am able to access my RD Session Host and Personal Collection via RD Web Access. But when i am accessing my pooled collection via RD Web Access, the wizard says loading the VM for a long time and Hangs. It then gives an error saying "This computer can`t connect to the Remote Computer". I would be really grateful if you answer it asap since i am currently deploying it. Thank you. Best Regards.

  • @Eduardo:

    Windows Server SKU is not supported as VM template image for VDI.

    @ lazerpld:

    Yes you can have same template image for two different collections. But after you update your template image, you will have to Recreate the two collections individually.

    @Ashish:

    Look for administrator logs in eventvwr.exe->"Applications and Services Logs"->"Microsoft"->Windows->

    - terminalservices-SessionBroker

    - terminalservices-tsv-vmhostagent

    It should provide you exact failure details on why connection is failing.

  • Ajay, thanks for the article.  I'm looking at this solution and had a few questions that I didn't find answers to yet.

    1.  I'm trying to create persistent VM collection.  If I create a collection with perhaps 2 VMs, is there a way to expand it to a larger number of VMs using that same template, or must I decide the exact size of the collection from the start?

    2.  Is there any known fix for support.microsoft.com/.../2974441  ?  This is quite a hindrance to using PRO/SCVMM for VDI.  I'm deploying my VMs to a cluster for HA and would like to manage with SCVMM.

    3.  The /mode:vm command is undocumented, does it apply to Windows 7 SP1 as well?

    Thank you.

  • Hi Ajay,

    Great information!! I have a VDI collection that I want to rename without using user interface. Is that possible? I couldn't find a cmdlet for it. But is there somewhere in the registry we can change the name?

    Thanks

    Heera

  • @Heera: Renaming of a collection is not possible.

    @Preston:

    1. Yes, you can easily add more VMs to an existing collection.  Check out the "Add-RDVirtualDesktopToCollection" cmdlet. There is a very easy option in the Server Manager->Remote Desktop Services->Collection node as well.

    2. This is a SCVMM issue and the workaround is mentioned in the KB itself.

    3. Here is the sysprep documentation: technet.microsoft.com/.../hh825033.aspx

    Mode VM is not supported in Windows 7.

Page 2 of 2 (25 items) 12