Adding a virtual desktop to an existing VM-based desktop group
This command adds a new virtual desktop, hosted by a VM, to an existing VM-based desktop group. Before adding a VM to the group, you must create a mapping between the VMs host ID and Active Directory ID. To do this, run the Get-XdHostedMachine cmdlet to obtain a list of host IDs for VMs and assign Active Directory IDs to those VMs.
# get all the groups whose name starts with 'test' (should be just one) $grp = Get-XdDesktopGroup test* # get all the workers whose friendly names have 'machine3' in them (should be just one) $dsk= Get-XdHostedMachine $grp.HostingSettings.HostingServer -name *machine3* # Set up the mapping to the AD name for the new Virtual Desktop machine $dsk.Name = 'machine3' $grp.Desktops.Add($dsk) Set-XdDesktopGroup $grp
If host ID to Active Directory ID mappings have been created previously, run the following command:
Get-XdDesktopGroup test* | %{ [void]$_.Desktops.Add
($(Get-XdHostedMachine $_.HostingSettings.HostingServer -name *machine3*)); $_ } |
Set-XdDesktopGroup
Add Comment