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

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

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

Camera redirection

This setting configures which cameras to redirect. These are the accepted values.
  • camerastoredirect:s: – Don´t redirect any cameras.

  • camerastoredirect:s:* – Redirect all cameras.
  • camerastoredirect:s: – Manually enter a list of cameras. Specific cameras are redirected using a semicolon-delimited list of interfaces KSCATEGORY_VIDEO_CAMERA.

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.
  • devicestoredirect:s:* – Redirect all plug-and-play devices.

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.
  • drivestoredirect:s:* –  Redirect all disk drives, including ones that are connected later.
  • drivestoredirect:s:dynamicdrives – Dynamics drives: redirect any drives that are connected later.
  • drivestoredirect:s: – Manually enter drives and labels. Specific drives using a semicolon-delimited list.

Clipboard redirection

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

  • redirectclipboard:i:0 – Clipboard on local computer isn’t available in remote session.
  • redirectclipboard:i:1 – Clipboard on local computer is available in remote session.

COM ports redirecction

This setting determines whether the COM ports on the client 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.
  • redirectcomports:i:1 – COM ports on the local computer are available in the remote session.

Location service redirecction

This setting determines whether location sharing on the client 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.
  • redirectlocation:i:1 – Enable location sharing from the local device and redirection to apps in the remote session.

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.
  • redirectprinters:i:1 – The printers on the local computer are available in the remote session.

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.
  • redirectsmartcards:i:1  – The smart card device will be redirected and available in the remote session.

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.
  • usbdevicestoredirect:s:* – Redirect all USB devices.
  • usbdevicestoredirect:s: – Manually enter devices by specifying the instance ID. Specific IDs using a semicolon-delimited list.

Define multiple custom RDP properties

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

And verify your changes with the Get-AzWvdHostPool cmdlet.

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

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

Camera redirection

This setting configures which cameras to redirect. These are the accepted values.
  • camerastoredirect:s: – Don´t redirect any cameras.

  • camerastoredirect:s:* – Redirect all cameras.
  • camerastoredirect:s: – Manually enter a list of cameras. Specific cameras are redirected using a semicolon-delimited list of interfaces KSCATEGORY_VIDEO_CAMERA.

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.
  • devicestoredirect:s:* – Redirect all plug-and-play devices.

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.
  • drivestoredirect:s:* –  Redirect all disk drives, including ones that are connected later.
  • drivestoredirect:s:dynamicdrives – Dynamics drives: redirect any drives that are connected later.
  • drivestoredirect:s: – Manually enter drives and labels. Specific drives using a semicolon-delimited list.

Clipboard redirection

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

  • redirectclipboard:i:0 – Clipboard on local computer isn’t available in remote session.
  • redirectclipboard:i:1 – Clipboard on local computer is available in remote session.

COM ports redirecction

This setting determines whether the COM ports on the client 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.
  • redirectcomports:i:1 – COM ports on the local computer are available in the remote session.

Location service redirecction

This setting determines whether location sharing on the client 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.
  • redirectlocation:i:1 – Enable location sharing from the local device and redirection to apps in the remote session.

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.
  • redirectprinters:i:1 – The printers on the local computer are available in the remote session.

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.
  • redirectsmartcards:i:1  – The smart card device will be redirected and available in the remote session.

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.
  • usbdevicestoredirect:s:* – Redirect all USB devices.
  • usbdevicestoredirect:s: – Manually enter devices by specifying the instance ID. Specific IDs using a semicolon-delimited list.

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.

device redirection

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