Forum Discussion
Get-AzWvdSessionHost returns Status of "Shutdown" instead of "Unavailable" when VM's are powered off
Why do Session Host VM's show the status of "Shutdown" when they are powered off instead of "Unavailable"?
I have been successfully utilizing an auto-scaling script that powers on/off VM's based on user demand. Until recently, all my VM's in my host pools show as status "Unavailable" when they are powered off and the scaling script looks for this and starts them when needed.
I have just added some additional VM's to my existing VM's in two of my Host Pools and now when I shut these VM's down, they show a status of "Shutdown" and so the scaling script cannot start them.
I have tried manually removing the new VM’s from the Host Pool and re-installing the Agent & BootLoader, but still no joy.
The status of “Shutdown” kind of makes more sense than “Unavailable”, so I wondered if there has been a change in the way the VM’s agent reports it’s status to WVD? If so, this would break the scaling script and it would need updating to suit, but I don’t see that this can be the case, as my original VM’s in the Host Pool are running the same latest agent version and show a status of “Unavailable” when they are powered off.
So - what is this "Shutdown" status all about and how do I get these new VM's to show as "Unavailable" when they are powered off so that my scaling script will work again?
Have you or anyone else seen this, or have any advice?
garymansell I modified the script to include the status of "Unavailable" and "Shutdown" to include VM's in the start function. Testing shows it's now starting VM's in either state.
7 Replies
- HussaynCopper Contributor
I've also noticed something similar in the last week when I added a vm to an existing hostpool, the new vm has a shutdown state not the regular unavailable state when its deallocated by the scaling script.
However I added yet another vm and that shows the regular unavailable status when the vm gets deallocated by the scaling script. Not really sure why
In my case the scaling script can power on and power off the all the vms.
I am curious what the difference is between the 'Shutdown' status and 'Unavailable' status as there is no detail on the docs page https://docs.microsoft.com/en-us/rest/api/desktopvirtualization/sessionhosts/get#status.
Perhaps Christiaan_Brinkhoff or AzureAcademy can shed some light?
- garymansellBrass Contributor
Hi Hussayn thanks for confirmation that others are seeing this.
I am using the (popular & useful) Travis Roberts scaling script (https://www.ciraltos.com/auto-start-and-stop-session-hosts-in-windows-virtual-desktop-spring-update-arm-edition-with-an-azure-function/) which checks for hosts in the "Unavailable" state to start, so the new hosts being in "Shutdown" state breaks the script.
I could probably modify the script, but I wanted to understand what this (new?) "Shutdown" state was all about first as my old hosts are all still showing state "Unavailable" even when running the same latest agent version as the newly added VM's.
I would very much appreciate some light shedding from @Christiaan_Brinkhoff or @Dean Cefola if they knew what this was about?
garymansell I modified the script to include the status of "Unavailable" and "Shutdown" to include VM's in the start function. Testing shows it's now starting VM's in either state.