Jump to content


Photo

Importing VMs via Powershell into Machine Groups

Started by Thomas Wagner , 21 April 2017 - 04:17 PM
1 reply to this topic

Thomas Wagner Members

Thomas Wagner
  • 1 posts

Posted 21 April 2017 - 04:17 PM

Hello,
 
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?
 
Regards,
Thomas

 



Nicholas Burton Members

Nicholas Burton
  • 36 posts

Posted 01 May 2017 - 02:58 PM

Run the process in the GUI once via Studio. Then, click "Citrix Studio <SiteName>" on the top-left MMC menu. You will be presented with "Common Tasks, Actions, PowerShell." Go to PowerShell and scroll all the way down, and it will tell you in PowerShell what your latest GUI actions were. I would start there first.

 

-Nick