XenDesktop 7.x Desktop integration with VMM Virtual Machine – VM migration

Last days I had to migrate couple VDI’s VM from one Hyper-V installation to another (separate VMM instances). But I didn’t want to recreate Catalogs and Desktop Groups. I just wanted to change the “link” from XD object (BrokerDesktop) to VMM object (Virtual Machine).

So let’s take a look, how this integration is implemented – I prepared a simple diagram:


In the box “Citrix XenDesktop 7.x” you can see BrokerDesktop object (that user can see and can connect to) and Hypervisor connection object. Of course, you can have many connections to many VMM installations.

So let’s start with PowerShell (I guess, that this operation is only possible in that way).

PS C:\> Add-PsSnapin Citrix.*

And list information about this connection (our machine name is VDI01 and domain: home.lab):

PS C:\> Get-BrokerDesktop [[-MachineName] ...]
MachineName Gets desktops with a specific machine name (in the form 'domain\machine').

Get-BrokerDesktop help and link to PowerShell documentation (for XenDesktop 7.6): PowerShell cmdlet help

PS C:\> Get-BrokerDesktop -MachineName "home.lab\VDI01" | select MachineName, HostedMachineId, HypervisorConnectionUid

HostedMachineId         : 874e03b5-2da3-4695-8153-d9cc8a30025d
HypervisorConnectionUid : 1
MachineName             : home.lab\VDI01

OK, so right now we will list VMM connections:

PS C:\> Get-BrokerHypervisorConnection

Capabilities               : {PowerOn, PowerOff, SuspendResume, Shutdown...}
HypHypervisorConnectionUid : 18496319-fa94-49aa-b37e-07d3e6448b7d
IsReady                    : True
MachineCount               : 3
MetadataMap                : {}
Name                       : VMM01
PreferredController        : home.lab\XD01
State                      : InMaintenanceMode
Uid                        : 1

Capabilities               : {PowerOn, PowerOff, SuspendResume, Shutdown...}
HypHypervisorConnectionUid : 593ddedb-99ec-409b-801d-f9696a0bf4af
IsReady                    : True
MachineCount               : 2
MetadataMap                : {}
Name                       : VMM02
PreferredController        : home.lab\XD01
State                      : On
Uid                        : 2

OK, so let’s say, that we moved our VM from one VMM (VMM01) to another (VMM02). We will have to change property of that Desktop to use the proper connection:

PS C:\> Set-BrokerMachine -MachineName "home.lab\VDI01" -HypervisorConnectionUid 2

But when we moved this VM to new VMM virtual machine ID might changed. So we will also have to change this value on XD. Let’s find out, what is the new ID for out VDI. Open PowerShell windows from VMM and type:

PS C:\> Get-VM "XD01" | select Name, ID

Name : XD01
ID   : ce9873ea-777a-4acd-a510-bd0e159fcb8a

As we can see, VM ID changed. So right now we will update this value in XD Desktop object:

PS C:\> Set-BrokerMachine -MachineName "home.lab\VDI01" -HostedMachineId "ce9873ea-777a-4acd-a510-bd0e159fcb8a"

And that’s all, now you have to restart Desktop services on all DDCs, to reload configuration and to be sure, that new VMs will be visible from XD perspective.


to get more information about hypervisor connections you can also use this commands (XDHyp object):

PS C:\> dir XDHyp:

PS C:\> dir XDHyp:\Connections

PSPath                      : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\Connections\VMM01
PSParentPath                : Citrix.Host.Admin.V2\Citrix.Hypervisor::XDHyp:\Connections
PSChildName                 : VMM01
PSDrive                     : XDHyp
PSProvider                  : Citrix.Host.Admin.V2\Citrix.Hypervisor
PSIsContainer               : True
ConnectionType              : SCVMM
HypervisorAddress           : {vmm01.home.lab}
HypervisorConnectionName    : VMM01
HypervisorConnectionUid     : 593ddedb-99ec-409b-801d-f9696a0bf4af
MaintenanceMode             : False
Metadata                    : {Citrix_Broker_MaxAbsoluteActiveActions = 50, Citrix_Broker_MaxAbsoluteNewActionsPerMinute = 10, Citrix_Broker_MaxPowerActionsPercentageOfDesktops = 10, Citrix_Broker_MaxPvdPowerActionsPercentageOfDesktops = 25}
MetadataMap                 :
Persistent                  : True
PluginId                    : MicrosoftPSFactory
Revision                    : ae0f417e-f4fe-4d49-9536-7a85d4e3c7f0
SupportsLocalStorageCaching : False
SupportsPvsVMs              : True
UserName                    : home.lab\xd_vmm_01
Scopes                      :
UsesCloudInfrastructure     : False
ConnectionTypeName          : SCVMM

Post author

There are 2 Comments

  1. Posted by Ginsmon Joseph Reply

    I am planning to create a script for me to add a new VM into XD Machine Catalog and my Hypervisor is SCVMM.
    Do you know how to find the HostedMachineId from SCVMM? Below commands does not seems to be working

    $VDIList = dir $VDIDataCenter -AdminAddress $AdminAddress |ForEach{ dir $_.FullPath | Where { $_.Name -eq $VDIName}}
    ForEach($VDIObject in $VDIList){$VDIID=$VDIObject.ID}

    This will work with VMware.

  2. Posted by JC Walser Reply

    Thought-provoking article – I am thankful for the analysis , Does anyone know where I can grab a sample IN ITD Form No. 49AA form to fill in ?

Leave a Reply