Jump to content


Importing VMs via Powershell into Machine Groups

Started by Thomas Wagner , 21 April 2017 - 04:17 PM

Thomas Wagner Members

Thomas Wagner
  • 1 posts

Posted 21 April 2017 - 04:17 PM

I have the following issue:
I am importing a virtual machine in a Machine group the following way:
Getting the SID from AD:
$NewVMObj = Get-ADComputer -Server DomainController.domain.net -Filter {Name -eq "WKSNAME"}
Getting UID from vCenter:
$vmObj = Get-Item "XDHyp:\Connections\Vcenter\DC.datacenter\Folder.folder\Host.computeresource\POOL.resourcepool\WKSNAME.vm"
Import machine:
New-BrokerMachine -CatalogUid 99 -HostedMachineId $vmObj.Id -HypervisorConnectionUid 1 -MachineName $NewVMObj.SID
Assign to DesktopGroup:
Get-BrokerMachine -SID $NewVMObj.SID | Add-BrokerMachine -DesktopGroup "DesktopGroup"
This works basicly, but two values are empty:
Get-BrokerMachine -SID $NewVMObj.SID
HostedMachineName           :
HostingServerName           :
When I import a machine via the GUI, these values are filled.
Question, what is wrong?
Or is there a way via powershell to fill this two values?