WVD Script-Based Integration to Manage Windows Virtual Desktop Host Pools

The script-based actions for Windows Virtual Desktop (WVD) in ControlUp, as introduced in a recent blog post, are mainly focused on the Host Pool and Session Host configurations. To keep you from switching back and forth between the ControlUp Console and Azure portal, we have integrated the Azure portal WVD actions via our script actions.

First things first

To use the script actions for WVD Host Pools, make sure you have followed the instructions from our knowledge base article Windows Virtual Desktop Setup Guide for ControlUp Integration to configure the script-based integration for WVD and to be ready to start managing your WVD Host Pool settings.

Show us the goodies

Once you have ControlUp configured for the script-based integration for WVD, you are all set to import our WVD Host Pool focused Script Actions from the Script Library:

NOTE: Make sure you import the WVD Store Azure Service Principal Credentials Script Action, as the WVD Stored credentials need to be configured in order to use the above Script Actions as they all re-use those stored credentials.

Figure 1 – WVD Store Azure Service Principal Credentials script action

All the Host Pool-focused script actions can be run from the Script Actions Context Menu of a WVD Session Host in the console, so you can immediately start mitigation actions for your WVD configuration, based on the monitoring feedback of those WVD Session Hosts. And the cool part is that the WVD script actions for the Hostpools can easily be run from a Session Host, as they will automatically retrieve the Hostpool information that the Session Host is a member of. You do not have to manually add that information when running a WVD Script Action.

Figure 2 – WVD Hostpool Script Actions available from the Script Actions context menu

Retrieve Hostpool information

We have created a number of Script Actions to retrieve the current configuration of your WVD Hostpool, based on the selected Session Host you run that action on. Let’s take a more detailed look at what each Script Action has to offer.

WVD Get Hostpool

This script gives you detailed information on the WVD Hostpool configuration. Based on the Session Host which you run the script, it will return the WVD Hostpool information for that Session Hose (similar to the information presented in the Azure portal). It will even check if the required PowerShell modules are installed and automatically install any missing module, as is shown in the example below.

Note: Keep in mind that the script action needs some additional time before showing the results when a missing PowerShell module is automatically installed.

Figure 3 – WVD Get Hostpool Script Based Action results

If you check the WVD Hostpool properties in the Azure portal, you’ll notice we made sure to provide you with the same detailed information.

Figure 4 – WVD Hostpool properties in the Azure portal

WVD Get Hostpool Session Hosts

Even though the WVD Session Hosts can already be sorted by Hostpool in the tree view in the left pane, we did want to provide a script action that will give you an overview of all Session Hosts in a particular Host Pool, by running the action on any Session Host within a Hostpool. This script will require no additional input information—such as a Hostpool name—as it will automatically retrieve that information from the WVD Session Host that is used to start the script action. So, even if you are not using the WVD-focused tree view in the left pane, you can still get a quick overview of all the Session Hosts that belong to a Hostpool.

Figure 5 – WVD Get Hostpool Session Hosts Script Based Action results

Where the tree view in the left pane gives you a quick overview of the Session Hosts in a Hostpool, it does not provide you with detailed status, drain mode, and active sessions information, like this does. And combined with the real-time monitoring information from the ControlUp Console, you’ll have all the information you need to keep track of your WVD Hostpool configuration and performance.

Figure 6 – WVD Session Host monitoring information

WVD Get Hostpool Application Groups

This script action will give you detailed information on the WVD Application groups that are configured and linked to the Hostpool. It will even show you Application Group Type, total number of applications, and the total number of Users (or Usergroups) assigned to that Application Group.

Figure 7 – WVD Get Hostpool Application Groups results

WVD Get Hostpool User Sessions

And even though the ControlUp Console allows you to zoom in on all the sessions that are running on a virtual machine, we still felt that this script action provides you with the added value to focus only on the WVD-specific User Sessions information for the entire Hostpool directly from the WVD infrastructure.

If you are looking for a particular user session, you can filter the output by specifying a user’s UserPrincipalName (UPN) or a part of the UPN to search for (wildcards are allowed).

Figure 8 – WVD Hostpool User Sessions input argument

If you leave the input Argument empty, the Script-Based action will return all User Sessions the WVD Hostpool, sorted by Session Host.

Get WVD Hostpool Image Information

To also provide you with some additional information that is not (yet) shown in the Azure portal, we added a script action that will show the WVD Hostpool image information, as selected during the deployment phase of the WVD Hostpool. The WVD Hostpool image information gives you a quick overview of the base image, used for the Session Hosts of the Hostpool and provides insights in whether or not a standard Gallery or Custom image was used for the Session Hosts. It also returns VM specific information, like the vmSize, name prefix and osDiskType.

Figure 10 – WVD Get Hostpool Image information results

As this information is not part of the detailed WVD Hostpool information in the Azure portal, we are hoping this script action offers a quick way to check which image is assigned to the WVD Hostpool and what VMsize was selected for the Session Hosts. This provides you with a quick overview to check how many resources are added to the Hostpool with each additional Session Host or resources are lost when removing a Session Host.

Update Hostpool information

In addition to the informational script actions, we also added script actions to change configuration settings of the WVD Hostpool, without having to leave the ControlUp console and switch to the Azure portal, like the load balancing algorithm and the max session limit settings.

This way you can even build custom triggers for automated mitigating actions, based on the real-time metrics of your Session Hosts.

WVD Set Hostpool Load Balancing Algorithm

This script action allows you to change the configured Load Balancing Algorithm of the Hostpool, as you might want to give users the best performance during peak office hours, using the BreadthFirst algorithm, but switch to the DepthFirst algorithm during off-peak hours from a Cost Management perspective.

NOTE: Read an explanation of the available load balancing algorithms.

Figure 11 – WVD Set Hostpool Load Balancing Algorithm input arguments
Figure 12 – WVD Set Hostpool Load Balancing Algorithm results

WVD Set Hostpool Max Session Limit

The last script action that we wanted to zoom in on allows you to chance the configured Max Session Limit of the Hostpool. We think this script supports a more dynamic configuration of the maximum number of users per Session Host, based on the real-time metrics shown in the ControlUp Console.

This way, we can create automated actions to tweak both the Max Session Limit and the Load Balancing Algorithm, based on the resource consumption off the Session Hosts. Finding that sweet spot of total number of users per Session Host for your WVD Hostpool and taking seasonal bursts of application and resource usage into account as well.

Keep in mind that both settings are configured at WVD Hostpool level, so they will be applied to all Session Hosts within the WVD Hostpool.

Figure 13 – WVD Set Hostpool Max Session Limit input arguments

As both Hostpool configuration script actions only return information on the performed action and changed values, feel free to run the WVD Get Hostpool script action to double check if the new values were set correctly and check the new values for the MaxSessionLimit and LoadBalancerType parameters of the WVD Hostpool.