Forum Discussion
Get-AzWvdSessionHost returns Status of "Shutdown" instead of "Unavailable" when VM's are powered off
- Nov 15, 2020
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.
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?
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?
- Nov 15, 2020
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.
- VenkataKrishnamurtiMar 11, 2021Copper Contributor
TravisRoberts Thanks for posting the script and its helpful, however I am getting the below error
: Host pool not set to Depth-First load balancing. This script requires Depth-First load balancing to execute
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptionI have set the host pool to depth first and using Get-AzWvdHostPool I can see the loadbalance type is set to Depth First
- Mar 11, 2021
VenkataKrishnamurti Can you verify you are using the WVDARM_ScaleHostPoolVMs.ps1 script with the newer, Spring update of WVD? Based on that error, you may be using the older version for the WVD Clasic.
Thanks
- garymansellNov 16, 2020Brass Contributor
TravisRobertsThis is excellent news - thanks for your speedy resolution. I made the same change myself last week and confirm that it works.
If anyone from the WVD Product Team is on here, though, it would be nice to understand why the change in Status for powered off machines? Is this a permanent change, will we no longer see VM's as "Unavailable"? If both states are still possible - what exactly do they mean>
Might be nice to add some descriptions to the online doc's too...
- HussaynNov 13, 2020Copper Contributor
Hi garymansell, the scaling script I used was the one they have in the wvd docs
https://docs.microsoft.com/en-us/azure/virtual-desktop/set-up-scaling-script
The logic is a bit differnet from the one you mentioned, both are really good.
It takes a bit of time to setup (or via ps script which I ended up doing as part of my wvd deploymet) but worth it to realise the cost savings.
This overview video really helped to understand whats going on
https://www.youtube.com/watch?v=4zDazJsa2Zk&t=4s
Additionally, I built a new environment today with 7 vm as personal desktops, all the vms show Shutdown state when they are deallocated.