I have written a Powershell Function which I use for Creating WVD Hostpools. Instead of clicking through the portal you now can create multiple hostpools by running this function.

Prerequisites

  • An Azure subscription
  • The Azure subscription needs to be prepared for WVD deployment
  • Install Powershell Modules (This is listed in the blog)

Powershell Function

This is the syntaxis for the script:

In addition, by default the script creates hostpools which are pooled and use “DepthFirst” with a 12 users session limit. Edit the script if needed. For example: BreathFirst with a 15 users sessionlimit.

Example

Firstly, open up Powershell and install the modules by using the following code:

Secondly, connect to Azure using this code:

Next up, select your subscription:

In addition, if you want to create multiple hostpools in different subscriptions you need to run the function multiple times in each context.

Next up, load the Powershell function in your Powershell session by pasting the code in the Powershell session:

Powershell Function for Creating WVD Hostpools


After that, run the function by using this code:

NOTE: If you create multiple hostpools, use this format: Hostpoolname1, Hostpoolname2 (the space between the names is mandatory, otherwise it does not work.) Furthermore, if the ResourceGroupName does not exist. The script creates the ResourceGroup

After that, the script has run and has created the following output:

Hostpools created with Powershell

And that is how you use a Powershell Function for creating WVD Hostpools!

References

Microsoft Docs about ResourceGroups

Other Posts at NielsKok.tech:
How to create Hostpools in General
WVD ARM Template update

Related Posts

5 thoughts on “Powershell Function for Creating WVD Hostpools

Leave a Reply

Your email address will not be published. Required fields are marked *