How to configure RDP properties for a Host Pool - Session behaviour
In my previous article, I showed you how to configure the connection information tab of the RDP properties for the host pool. Today, I will show you how to configure the session behavior tab of the RDP properties using PowerShell and Azure CLI.
Azure PowerShell Workaround #
First, you need to ensure the Az.DesktopVirtualization module is installed on your computer and imported into your PowerShell session. To do that, you should use the following commands.
Install-Module Az.DesktopVirtualization
Import-Module Az.DesktopVirtualization
Once you’ve imported the module, you’re ready to go. The easiest way to get started is to log in interactively at the command line.
Connect-AzAccount
This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account. You can choose the default subscription if you have more than one associated with your mail account. To perform this task, we will use the following commands:
Get-AzSubscription
Select-AzSubscription -Subscription "My Subscription"
Once you set your default subscription, you’re ready to start.
Set the variables #
Here, we define the characteristics of our environment and the resource’s properties.
$resourceGroupName="RG-DEMO-WE"
$hostPoolName="HP-DEMO-WE"
Define RDP properties for the session behaviour #
To set a custom RDP property, you should use the Update-AzWvdHostPool cmdlet.
Reconnection #
This setting determines whether the client computer will automatically try to reconnect to the remote computer if the connection is broken. These are the accepted values.
- autoreconnection enabled:i:1 - The client automatically tries to connect.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "autoreconnection enabled:i:1"
- autoreconnection enabled:i:0 - The client does not try to connect automatically.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "autoreconnection enabled:i:0"
Bandwidth auto detect #
This setting determines whether or not automatic network bandwidth detection is used. These are the accepted values.
- bandwidthautodetect:i:1 - Use automatic network bandwidth.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "bandwidthautodetect:i:1"
- bandwidthautodetect:i:0 -Don’t use automatic network bandwidth
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "bandwidthautodetect:i:0"
Network auto detect This setting enables the automatic network type detection option. These are the accepted values.
- **_networkautodetect:i:1 - _**Enable automatic network type connection.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "networkautodetect:i:1"
- **networkautodetect:i:0 - **Disable automatic network type connection.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "networkautodetect:i:0"
Compression #
This setting determines whether the connection should use bulk compression. These are the accepted values.
- compression:i:1 - Enable RDP bulk compression.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "compression:i:1"
- **compression:i:0 - **Disable RDP bulk compression.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "compression:i:0"
Video playback #
This setting determines whether the RDC will use RDP’s efficient media stream for video playback. These are the accepted values.
- videoplaybackmode:i:1
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "videoplaybackmode:i:1"
- videoplaybackmode:i:0
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "videoplaybackmode:i:0"
Define multiple custom RDP properties #
You should use the Update-AzWvdHostPool cmdlet with the following syntax to set multiple custom RDP properties.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty "autoreconnection enabled:i:1;bandwidthautodetect:i:1;networkautodetect:i:1;compression:i:1;videoplaybackmode:i:1"
And verify your changes with the Get-AzWvdHostPool cmdlet.
Get-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
| format-list Name, CustomRdpProperty
Reset all custom RDP properties #
If you want to reset all custom RDP properties, you should use the Update-AzWvdHostPool cmdlet with the following syntax.
Update-AzWvdHostPool `
-Name $hostPoolName `
-ResourceGroupName $resourceGroupName `
-CustomRdpProperty ""
Azure CLI Workaround #
In this case, we will use Azure Cloud Shell, a browser-based shell built into Azure Portal. This allows us to use the Azure command-line tools (Azure CLI and Azure PowerShell) directly from a browser. If you want to know more about Azure Cloud Shell, check out this link. First, we define the characteristics of our environment and store the values in variables.
resourceGroupName="RG-DEMO-WE"
hostPoolName="HP-DEMO-WE"
Define RDP properties for the session behaviour #
To set a custom RDP property, you should use the following command.
Reconnection #
This setting determines whether the client computer will automatically try to reconnect to the remote computer if the connection is broken. These are the accepted values.
- autoreconnection enabled:i:1 - The client automatically tries to connect.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "autoreconnection enabled:i:1"
- autoreconnection enabled:i:0 - The client does not try to connect automatically.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "autoreconnection enabled:i:0"
Bandwidth auto detect #
This setting determines whether or not automatic network bandwidth detection is used. These are the accepted values.
- bandwidthautodetect:i:1 - Use automatic network bandwidth.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "bandwidthautodetect:i:1"
- bandwidthautodetect:i:0 -Don’t use automatic network bandwidth
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "bandwidthautodetect:i:0"
Network auto detect This setting enables the automatic network type detection option. These are the accepted values.
- _networkautodetect:i:1 - _Enable automatic network type connection.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "networkautodetect:i:1"
- _networkautodetect:i:0 - _Disable automatic network type connection.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "networkautodetect:i:0"
Compression #
This setting determines whether the connection should use bulk compression. These are the accepted values.
- compression:i:1 - Enable RDP bulk compression.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "compression:i:1
- _compression:i:0 - _Disable RDP bulk compression.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "compression:i:0"
Video playback #
This property determines whether the RDC will use RDP’s efficient media stream for video playback. These are the accepted values.
- videoplaybackmode:i:1
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "videoplaybackmode:i:1"
- videoplaybackmode:i:0
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "videoplaybackmode:i:0"
Define multiple custom RDP properties #
To set multiple custom RDP properties, you should use the following command.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "autoreconnection enabled:i:1;bandwidthautodetect:i:1;networkautodetect:i:1;compression:i:1;videoplaybackmode:i:1"
And verify your changes with the following command.
az desktopvirtualization hostpool show \
--name $hostPoolName \
--resource-group $resourceGroupName \
--query "[name, customRdpProperty]"
Reset all custom RDP properties #
If you want to reset all custom RDP properties, you should use the following command.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property ""
Thanks for reading my post. I hope you find it helpful.
In the next article, I’ll explain how to configure RDP properties for a Host Pool - Device redirection.
Check out this link if you want to know more about Azure Virtual Desktop.