XenApp Machine Power State Uknown or Incorrect

Issue: Citrix Studio showing the power state for a machine as Unknown or incorrect (i.e. Studio says the machine is On when it’s in fact powered off or vice versa) following a vcenter outage.

I have quite quickly found https://support.citrix.com/article/CTX131267?_ga=2.83298006.1304926953.1588149335-464024711.1570620116 and following the instructions established that the Machine IDs are mismatched between the Citrix and vCenter databases.

To check quickly check:

  1. On a Citrix Delivery Controller run the following in powershell:

    asnp Citrix*
    Get-BrokerMachine | Select-Object -Property MachineName, PowerState, RegistrationState, HostedMachineId

    This will give you details for each machine as they are in the Citrix database.

  2. Now run:
    Get-ChildItem -Path XdHyp:\ -force -recurse | ?{ $_.IsMachine } | Out-File –Filepath c:\xdhyp.txt

    This will give you details from vmware.

  3. Look up one of the problem machines in xdhyp.txt and compare the ID with the HostedMachineID from step 1. You should see that they are different.

The Citrix article would have you believe that you can change the ID in the Citrix database by running

Set-BrokerMachine -MachineName ‘MyDomain\MyMachine’ -HostedMachineId

However this will error with:

Set-BrokerMachine : The term ‘Set-BrokerMachine’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

To get around this you will need to edit the vmx files of the affected machines with the HostedMachineID from the Citrix Database.

This is fine if you only have a handful of machines to correct but otherwise it might be quicker to just delete those machines and create new ones. I’m not sure if editing the Citrix Database directly would also be an option.

Editing the vmx files:

  1. Shutdown the machine
  2. Browse the datastore the machine is on and download the machinename.vmx file.
  3. Open in notepad and search for “uuid.bios
  4. You should see this is different to the HostedMachineID you’ve got earlier and matches the ID from the xdhyp.txt file.

    “uuid.bios = “56 4d 01 d4 26 c8 9a bf-fa 27 b5 74 61 70 0e f2”

  5. Replace the uuid.bios value with the HostedMachineID making sure you follow the same format. For example if the powershell output looks like this:
    edit it into the following format:
    42 06 18 61 55 3b 95 0b-55 a3 6d a7 13 ee 70 1e
  6. Save the vmx file.
  7. Remove the vmx file from the datastore (make sure you have a copy).
  8.  Upload the edited vmx file into the datastore.
  9. Power the machine back on and you should see the correct Power Status in Citrix Studio.




Installing drivers on ESXi 5.5 using esxcli

Today’s post is nothing revolutionary I’m afraid and is more for my own reference than anything else. I couldn’t recommend this VMware article more: http://kb.vmware.com/selfservice/search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=2137854 . It comes with a video too.

I had to update the network adapter and the raid controller drivers

Before you start:

  1. Check / Enable SSH using vSphere client:
    • Select the host, click the Configuration tab, and click Security Profile in the Software panel.
    • In the Services section, click Properties.
    • Select ESXi Shell and click Options
    • Change the ESXi Shell options (Start/Start and stop with host).
    • OK.
  1. Check full datastore path:
    • Log in as root to the ESXi console through SSH.
    • Run esxcli storage filesystem list
    • Identify the datastore you are going to use for your drivers and record the mount point path ( I am using the ISO datastore so /vmfs/volumes/4e024984-a6c3ca91-a8bf-b499baa912d9 is what I need):



  1. Download drivers from VMware.
  2. Extract the contents of the async driver zip file.
  3. Identify the offline-bundle.zip file(s).
  4. Extract the contents of the offline-bundle.zip file(s).
  5. Identify the async-driver.vib file(s).
  6. Log in to the ESXi host using the vSphere Client with administrator privileges, such as root.
  7. Using Datastore Browser, upload the async-driver.vib file(s) to an ESXi host’s datastore.
  8. Enter the host into maintenance mode. (This means either shutting down or migrating all VMs on that host.)
  9. Log in as root to the ESXi console through SSH.
  10. Run this command to install drivers from the VIB file:
    esxcli software vib install –v /path/async-driver.vib
    For example:  esxcli software vib install -v /vmfs/volumes/55a47a7f-11c62c90-711e-d8b190a2deb2/LSI_bootbank_scsi-megaraid-sas_6.606.06.00-
  11. Restart the ESXi host.
  12. To confirm if the VIB is installed successfully, run this command to check the version:
    esxcli software vib list | grep -i vib_name
    For example: vib list | grep -i scsi-megaraid-sas
  13. Exit maintenance mode.