“Unknown” Power State in XenDesktop 5.X

All my VDI’s went to Unknown Power state after an issue with Hyper-V. I wasn’t able to use power options to control vdi’s from Desktop Studio.

To fix this issue:

Click on “Launch Powershell” Tab from Desktop Studio or open a Powershell from Xendesktop Controller.
If you use the Powershell from studio you don’t have to load the cmdlets

1) Add-PSSnapIn Citrix.*

2) cd XDHyp:\
Get-ChildItem -recurse | Out-File –Filepath c:\xdhyp.txt

Above command’s output xdhyp.txt file contains the correct machine IDs from the hypervisor.
when you open the xdhyp.txt file, One VM would have all the below details. For Example:

PSPath         : Citrix.Host.Admin.V1\Citrix.Hypervisor::XDHyp:\Connections\XXX
PSParentPath : Citrix.Host.Admin.V1\Citrix.Hypervisor::XDHyp:\Connections\XXX
PSChildName : VDI001.vm
PSDrive : XDHyp
PSProvider : Citrix.Host.Admin.V1\Citrix.Hypervisor
PSIsContainer : True
Name : VDI001
FullName : VDI001.vm
ObjectType : Vm
Id : e16c059b-6422-45ce-928f-03e6a6a561e3
IsContainer : True
IsMachine : True
IsSnapshotable : True
ObjectPath : /XXX.hostgroup/CITRIX-XD56.hostgroup/XXX.cluster/XXX.vm
FullPath : XDHyp:\Connections\XXX_XENDESKTOP\XXX.hostgroup\CITRIX-XD56.
IsSymLink : False
AdditionalData : {}

All you need is the Machine name, ID and the domain name(which you should be knowing very well)

3) If you require the list of VM’s that are in Unknown Powerstate (which you will be already knowing) execute the below command. If you know the list of machines, skip this.

Get-BrokerMachine -PowerState Unknown

4) Set-BrokerMachine -MachineName ‘MyDomain\MyMachine’ -HostedMachineId  [machine ID from xdhyp.txt file]

5) Refresh Xendesktop Studio and Power State of a VM will now match with Hypervisor. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s