Nov 12 2020 06:09 AM
Nov 12 2020 06:09 AM
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?
Nov 12 2020 06:25 PM
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.
Nov 13 2020 12:07 AM
Hi @Hussayn Visram 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-...) 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.
Nov 13 2020 10:20 AM
Hi @garymansell, the scaling script I used was the one they have in the wvd docs
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
Additionally, I built a new environment today with 7 vm as personal desktops, all the vms show Shutdown state when they are deallocated.
Nov 15 2020 11:17 AMSolution
@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.
Nov 16 2020 01:42 AM
@Travis RobertsThis 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...
Mar 10 2021 06:35 PM
@Travis Roberts 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.WriteErrorException
I have set the host pool to depth first and using Get-AzWvdHostPool I can see the loadbalance type is set to Depth First
Mar 10 2021 06:49 PM
@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.