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).
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.
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:
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.
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:
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.
While trying these example cmdlets, please replace these names with the appropriate values in your deployment.
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,
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?
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.
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.
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?)
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?
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.
Windows Server SKU is not supported as VM template image for VDI.
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.
Look for administrator logs in eventvwr.exe->"Applications and Services Logs"->"Microsoft"->Windows->
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?
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?
@Heera: Renaming of a collection is not possible.
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.