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.

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.

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:

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.

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.
  • autoreconnection enabled:i:0 – The client does not try to connect automatically.

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.
  • bandwidthautodetect:i:0 -Don’t use automatic network bandwidth

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.
  • networkautodetect:i:0 – Disable automatic network type connection.

Compression

This setting determines whether the connection should use bulk compression. These are the accepted values.

  • compression:i:1 – Enable RDP bulk compression.
  • compression:i:0 – Disable RDP bulk compression.

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
  • 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.

And verify your changes with the Get-AzWvdHostPool cmdlet.

Update-AzWvdHostPool

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.

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.

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.
  • autoreconnection enabled:i:0 – The client does not try to connect automatically.

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.
  • bandwidthautodetect:i:0 -Don’t use automatic network bandwidth

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.
  • networkautodetect:i:0 – Disable automatic network type connection.

Compression

This setting determines whether the connection should use bulk compression. These are the accepted values.

  • compression:i:1 – Enable RDP bulk compression.
  • compression:i:0 – Disable RDP bulk compression.

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
  • videoplaybackmode:i:0

Define multiple custom RDP properties

To set multiple custom RDP properties, you should use the following command.

And verify your changes with the following command.

RDP properties Session behaviour

Reset all custom RDP properties

If you want to reset all custom RDP properties, you should use the following command.

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.