If you manage a Citrix environment chances are you’re using hosting connections to manage power actions. Whether it’s for MCS/PVS, reboot schedules, or to simply perform a reboot or shutdown on VMs from Citrix Studio. One of the bigger “Gotchas” I see is when the power state changes to ‘unknown’. This can be due to various reasons.
- Deleting the VM at the hypervisor level and creating a new one
- Moving the VM to a different cluster
- Issues with the Hosting connection, such as expiring service account, expired SSL Certificate, and more
There are different fixes for these problems that are mostly well documented. Just Googling “Citrix Power State Unknown” serves up a bunch of different articles and blogs for all the different possible solutions to the problem. Majority of the time, to find the root cause, you should preform a ‘Test Connection’ on the Hosting connection itself from Citrix Studio. This will perform various connectivity tests to help you understand the reason.
During the time that the VM has a Power State of Unknown there could be different sorts of conditions where it has ‘Pending’ actions. Maybe from a reboot schedule, the Help Desk performing manual reboots, Automated VDI logoff/shutdown actions, or any other number of reasons.
What is NOT talked about a lot before you fix the ‘unknown’ Power State is checking for any Pending actions. If this isn’t done, after you fix the Power State, those pending actions will continue to be processed.
For example: Say your Citrix hosting connection hypervisor SSL Certificate expired. You walk through a method in this article https://support.citrix.com/s/article/CTX224551-delivery-controller-cannot-contact-vcenter-server-after-certificate-update-on-vcenter?language=en_US to fix the issue. Shortly after, all of your VMs start rebooting due to pending power state actions that were applied from a reboot schedule on the Delivery Group.
In order to solve this you need to check for all Pending Power Actions and remove them before continuing to fix whatever the root cause reason for power state ‘unknown’.
#Get a list of all Pending Power State Actions
Get-BrokerHostingPowerAction -Filter { State -eq "Pending"}
#Get a list of ALL power actions
Get-brokerhostingpoweraction | Select action, ActionCompletionTime,HostedMachineName,State
Finally, we’ll want to remove those Pending Actions. Here is a good one liner if you’d like to remove them all.
#Remove all Pending Power Actions
Get-BrokerHostingPowerAction -Filter { State -eq "Pending"} | Remove-BrokerHostingPowerAction
After the Pending Power Actions have been removed, then proceed to fixing the Power State. Hope this helps prevent some unwanted reboots for you folks.