Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to configure RDP properties for a Host Pool - Device redirection

·2112 words·10 mins· 100 views · 5 likes ·
Azure CLI Azure PowerShell Azure Virtual Desktop Connect-AzAccount

Hi, Jorge is back. As I mentioned in my previous post, I will show you the second part of configuring device redirections for your Azure Virtual Desktop environment using PowerShell and Azure CLI. If you missed the first part, here is the link. Ok, let’s go through each setting one by one.

Azure PowerShell Workaround>

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>

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 Local devices redirection>

Define RDP properties for Local devices redirection #

To set a custom RDP property, you should use the Update-AzWvdHostPool cmdlet.

Camera redirection>

Camera redirection #

This setting configures which cameras to redirect. These are the accepted values.

  • camerastoredirect:s: - Don´t redirect any cameras.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "camerastoredirect:s:"
  • camerastoredirect:s:* - Redirect all cameras.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "camerastoredirect:s:*"
  • camerastoredirect:s: - Manually enter a list of cameras. Specific cameras are redirected using a semicolon-delimited list of interfaces KSCATEGORY_VIDEO_CAMERA.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "camerastoredirect:s:\\?\\USB#VID_04F2&PID_B422&MI_00\;\\?\\USB#VID_04F2&PID_B480&MI_00"
MTP and PTP device redirection>

MTP and PTP device redirection #

This setting allows plug-and-play devices, PTP digital cameras, or MTP music players to be redirected. These are the accepted values.

  • devicestoredirect:s: - Don’t redirect any device.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "devicestoredirect:s:"
  • devicestoredirect:s:* - Redirect all plug-and-play devices.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "devicestoredirect:s:*"
Drive/storage redirecction>

Drive/storage redirecction #

This setting determines which local disk drives on the client computer will be redirected and available in the remote session. These are the accepted values. These are the accepted values.

  • drivestoredirect:s: - Don’t redirect any drives.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "drivestoredirect:s:"
  • drivestoredirect:s:* -  Redirect all disk drives, including ones that are connected later.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "drivestoredirect:s:*"
  • drivestoredirect:s:dynamicdrives - Dynamics drives: redirect any drives that are connected later.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "drivestoredirect:s:dynamicdrives"
  • drivestoredirect:s: - Manually enter drives and labels. Specific drives using a semicolon-delimited list.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "drivestoredirect:s:C\:\\;F\:\"
Clipboard redirection>

Clipboard redirection #

This setting determines whether the clipboard on the client’s computer will be redirected and available in the remote session. These are the accepted values.

  • redirectclipboard:i:0 - Clipboard on the local computer isn’t available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectclipboard:i:0"
  • redirectclipboard:i:1 - Clipboard on the local computer is available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectclipboard:i:1"
COM ports redirecction>

COM ports redirecction #

This setting determines whether the COM ports on the client’s computer will be redirected and made available in the remote session. These are the accepted values.

  • redirectcomports:i:0 - COM ports on the local computer are not available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectcomports:i:0"
  • redirectcomports:i:1 - COM ports on the local computer are available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectcomports:i:1"
Location service redirecction>

Location service redirecction #

This setting determines whether location sharing on the client’s computer will be redirected and available in the remote session. These are the accepted values.

  • redirectlocation:i:0 - Disable location sharing from the local device.
Update-AzWvdHostPool -Name $hostPoolName \`
-ResourceGroupName $resourceGroupName \`
-CustomRdpProperty "redirectlocation:i:0"
  • redirectlocation:i:1 - Enable location sharing from the local device and redirection to apps in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectlocation:i:1"
Printer redirection>

Printer redirection #

This setting determines whether printers configured on the local computer will be redirected and made available in the remote session. These are the accepted values.

  • redirectprinters:i:0 - The printers on the local computer are not available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectprinters:i:0"
  • redirectprinters:i:1 - The printers on the local computer are available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectprinters:i:1"
Smart card redirecction>

Smart card redirecction #

This setting determines whether smart card devices on the local computer will be redirected and available in the remote session. These are the accepted values.

  • redirectsmartcards:i:0 - The smart card device will not be redirected and available in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirectsmartcards:i:0"
  • redirectsmartcards:i:1  - The smart card device will be redirected and available in the remote session.
Update-AzWvdHostPool -Name $hostPoolName \`
-ResourceGroupName $resourceGroupName \`
-CustomRdpProperty "redirectsmartcards:i:1"
USB device redirecction>

USB device redirecction #

This setting determines which supported RemoteFX USB devices on the client computer will be redirected and available in the remote session. These are the accepted values.

  • usbdevicestoredirect:s: - Don’t redirect any USB devices.
Update-AzWvdHostPool -Name $hostPoolName \`
-ResourceGroupName $resourceGroupName \`
-CustomRdpProperty "usbdevicestoredirect:s:"
  • usbdevicestoredirect:s:* - Redirect all USB devices.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "usbdevicestoredirect:s:*"
  • usbdevicestoredirect:s: - Manually enter devices by specifying the instance ID. Specific IDs using a semicolon-delimited list.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "usbdevicestoredirect:s:72631e54-7894-11d0-bc7-00a007b32a\;53d29ef7-377c-4014-864b-eb3a857693599"
Define multiple custom RDP properties>

Define multiple custom RDP properties #

To set multiple custom RDP properties, you should use the Update-AzWvdHostPool cmdlet with the following syntax.

Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "camerastoredirect:s:*;redirectprinters:i:1;usbdevicestoredirect:s:;drivestoredirect:s:C\:\;F\:\"

And verify your changes with the Get-AzWvdHostPool cmdlet.

Get-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    | format-list Name, CustomRdpProperty

Get-AzWvdHostPool

Reset all custom RDP properties>

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>

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 Local devices redirection>

Define RDP properties for Local devices redirection #

To set a custom RDP property, you should use the following command.

Camera redirection>

Camera redirection #

This setting configures which cameras to redirect. These are the accepted values.

  • camerastoredirect:s: - Don´t redirect any cameras.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "camerastoredirect:s:"
  • camerastoredirect:s:* - Redirect all cameras.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "camerastoredirect:s:*"
  • camerastoredirect:s: - Manually enter a list of cameras. Specific cameras are redirected using a semicolon-delimited list of interfaces KSCATEGORY_VIDEO_CAMERA.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "camerastoredirect:s:\\?\\USB#VID_04F2&PID_B422&MI_00\;\\?\\USB#VID_04F2&PID_B480&MI_00"
MTP and PTP device redirection>

MTP and PTP device redirection #

This setting allows plug-and-play devices, PTP digital cameras, or MTP music players to be redirected. These are the accepted values.

  • devicestoredirect:s: - Don’t redirect any device.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "devicestoredirect:s:"
  • devicestoredirect:s:* - Redirect all plug-and-play devices.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "devicestoredirect:s:*"
Drive/storage redirecction>

Drive/storage redirecction #

This setting determines which local disk drives on the client computer will be redirected and available in the remote session. These are the accepted values. These are the accepted values.

  • drivestoredirect:s: - Don’t redirect any drives.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "drivestoredirect:s:"
  • drivestoredirect:s:* -  Redirect all disk drives, including ones that are connected later.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "drivestoredirect:s:*"
  • drivestoredirect:s:dynamicdrives - Dynamics drives: redirect any drives that are connected later.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "drivestoredirect:s:dynamicdrives"
  • drivestoredirect:s: - Manually enter drives and labels. Specific drives using a semicolon-delimited list.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "drivestoredirect:s:C\\:\\;F\\:"
Clipboard redirection>

Clipboard redirection #

This setting determines whether the clipboard on the client’s computer will be redirected and available in the remote session. These are the accepted values.

  • redirectclipboard:i:0 - Clipboard on the local computer isn’t available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectclipboard:i:0"
  • redirectclipboard:i:1 - Clipboard on the local computer is available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectclipboard:i:1"
COM ports redirecction>

COM ports redirecction #

This setting determines whether the COM ports on the client’s computer will be redirected and made available in the remote session. These are the accepted values.

  • redirectcomports:i:0 - COM ports on the local computer are not available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectcomports:i:0"
  • redirectcomports:i:1 - COM ports on the local computer are available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectcomports:i:1"
Location service redirecction>

Location service redirecction #

This setting determines whether location sharing on the client’s computer will be redirected and available in the remote session. These are the accepted values.

  • redirectlocation:i:0 - Disable location sharing from the local device.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectlocation:i:0"
  • redirectlocation:i:1 - Enable location sharing from the local device and redirection to apps in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectlocation:i:1"
Printer redirection>

Printer redirection #

This setting determines whether printers configured on the local computer will be redirected and made available in the remote session. These are the accepted values.

  • redirectprinters:i:0 - The printers on the local computer are not available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectprinters:i:0"
  • redirectprinters:i:1 - The printers on the local computer are available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectprinters:i:1"
Smart card redirecction>

Smart card redirecction #

This setting determines whether smart card devices on the local computer will be redirected and available in the remote session. These are the accepted values.

  • redirectsmartcards:i:0 - The smart card device will not be redirected and available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectsmartcards:i:0"
  • redirectsmartcards:i:1  - The smart card device will be redirected and available in the remote session.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirectsmartcards:i:1"
USB device redirecction>

USB device redirecction #

This setting determines which supported RemoteFX USB devices on the client computer will be redirected and available in the remote session. These are the accepted values.

  • usbdevicestoredirect:s: - Don’t redirect any USB devices.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "usbdevicestoredirect:s:"
  • usbdevicestoredirect:s:* - Redirect all USB devices.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "usbdevicestoredirect:s:*"
  • usbdevicestoredirect:s: - Manually enter devices by specifying the instance ID. Specific IDs using a semicolon-delimited list.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "usbdevicestoredirect:s:72631e54-7894-11d0-bc7-00a007b32a\;53d29ef7-377c-4014-864b-eb3a857693599"
Define multiple custom RDP properties>

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 "camerastoredirect:s:*;redirectprinters:i:1;usbdevicestoredirect:s:;drivestoredirect:s:C\\:\\;F\\:"

And verify your changes with the following command.

az desktopvirtualization hostpool show \
--name $hostPoolName \
--resource-group $resourceGroupName \
--query "[name, customRdpProperty]"

device redirection

Reset all custom RDP properties>

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 following article, I’ll explain how to configure RDP properties for a Host Pool - Display settings.

Check out this link to learn more about Configuring Device redirection.