The series of posts on configuring RDP properties for a host pool is ending. In this latest post, I’ll show you how to configure display settings for your Azure virtual desktop environment using PowerShell and the Azure CLI. 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.
1 2 3 4 | 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.
1 2 3 | 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:
1 2 3 4 | 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.
1 2 3 4 | $resourceGroupName="RG-DEMO-WE" $hostPoolName="HP-DEMO-WE" |
Define RDP properties for Local devices redirection
To set a custom RDP property, you should use the Update-AzWvdHostPool cmdlet.
Multiple displays
- use multimon:i:0 – Don’t enable multiple display support.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:0" |
- use multimon:i:1 – Enable multiple display support.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1" |
Selected monitors
- use multimon:i:1;selectedmonitors:s: – All displays.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;selectedmonitors:s:" |
- use multimon:i:1;selectedmonitors:s:IDXXXX,IDXXXX – Manually enter list of machine specific display IDs. The selected screens must be contiguous.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;selectedmonitors:s:ID5555,ID7722" |
Maximize to current displays
- use multimon:i:1;maximizetocurrentdisplays:i:0 – Session goes full screen on the displays initially selected when maximizing.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;maximizetocurrentdisplays:i:0" |
- use multimon:i:1;maximizetocurrentdisplays:i:1 – Session dynamically goes full screen on the displays touched by the session window when maximizing.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;maximizetocurrentdisplays:i:1" |
Multi to single display switch
- use multimon:i:1;singlemoninwindowedmode:i:0 – Session retains all displays when exiting full screen.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;singlemoninwindowedmode:i:0" |
- use multimon:i:1;singlemoninwindowedmode:i:1 – Session switches to single display when exiting full screen.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "use multimon:i:1;singlemoninwindowedmode:i:1" |
Screen mode
- screen mode id:i:1 – The remote session will appear in a window.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "screen mode id:i:1" |
- screen mode id:i:2 – The remote session will appear full screen.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "screen mode id:i:2" |
Smart sizing
- smart sizing:i:0 – The local window content won’t scale when resized.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "smart sizing:i:0" |
- smart sizing:i:1 – The local window content will scale when resized.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "smart sizing:i:1" |
Dynamic resolution
- dynamic resolution:i:0 – Session resolution remains static for the duration of the session.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "dynamic resolution:i:0" |
- dynamic resolution:i:1 – Session resolution update as the local window resizes.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "dynamic resolution:i:1" |
Desktop size
- desktop size id:i:0 – 640 x 480
- desktop size id:i:1 – 800 x 600
- desktop size id:i:2 – 1024 x 768
- desktop size id:i:3 – 1280 x 1024
- desktop size id:i:4 – 1600 x 1200
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "desktop size id:i:3" |
Desktop height (pixels)
- desktopheight:i:value
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "desktopheight:i:1920" |
Desktop width (pixels)
- desktopwidth:i:value
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "desktopwidth:i:1080" |
Desktop scale factor
- desktopscalefactor:i:100
- desktopscalefactor:i:125
- desktopscalefactor:i:150
- desktopscalefactor:i:175
- desktopscalefactor:i:200
- desktopscalefactor:i:250
- desktopscalefactor:i:300
- desktopscalefactor:i:400
- desktopscalefactor:i:500
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "desktopscalefactor:i:150" |
Define multiple custom RDP properties
You should use the Update-AzWvdHostPool cmdlet with the following syntax to set multiple custom RDP properties.
1 2 3 4 5 | Update-AzWvdHostPool -Name $hostPoolName ` -ResourceGroupName $resourceGroupName ` -CustomRdpProperty "desktopheight:i:1920;desktopwidth:i:1080" |
And verify your changes with the Get-AzWvdHostPool cmdlet.
1 2 3 4 | 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.
1 2 3 4 5 | 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.
1 2 3 4 | resourceGroupName="RG-DEMO-WE" hostPoolName="HP-DEMO-WE" |
Define RDP properties for Local devices redirection
To set a custom RDP property, you should use the following command.
Multiple displays
- use multimon:i:0 – Don’t enable multiple display support.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:0" |
- use multimon:i:1 – Enable multiple display support.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1" |
Selected monitors
- use multimon:i:1;selectedmonitors:s: – All displays.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;selectedmonitors:s:" |
- use multimon:i:1;selectedmonitors:s:IDXXXX,IDXXXX – Manually enter list of machine specific display IDs. The selected screens must be contiguous.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;selectedmonitors:s:ID5555,ID7722" |
Maximize to current displays
- use multimon:i:1;maximizetocurrentdisplays:i:0 – Session goes full screen on the displays initially selected when maximizing.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;maximizetocurrentdisplays:i:0" |
- use multimon:i:1;maximizetocurrentdisplays:i:1 – Session dynamically goes full screen on the displays touched by the session window when maximizing.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;maximizetocurrentdisplays:i:1" |
Multi to single display switch
- use multimon:i:1;singlemoninwindowedmode:i:0 – Session retains all displays when exiting full screen.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;singlemoninwindowedmode:i:0" |
- use multimon:i:1;singlemoninwindowedmode:i:1 – Session switches to single display when exiting full screen.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "use multimon:i:1;singlemoninwindowedmode:i:1" |
Screen mode
- screen mode id:i:1 – The remote session will appear in a window.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "screen mode id:i:1" |
- screen mode id:i:2 – The remote session will appear full screen.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "screen mode id:i:2" |
Smart sizing
- smart sizing:i:0 – The local window content won’t scale when resized.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "smart sizing:i:0" |
- smart sizing:i:1 – The local window content will scale when resized.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "smart sizing:i:1" |
Dynamic resolution
- dynamic resolution:i:0 – Session resolution remains static for the duration of the session.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "dynamic resolution:i:0" |
- dynamic resolution:i:1 – Session resolution update as the local window resizes.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "dynamic resolution:i:1" |
Desktop size
- desktop size id:i:0 – 640 x 480
- desktop size id:i:1 – 800 x 600
- desktop size id:i:2 – 1024 x 768
- desktop size id:i:3 – 1280 x 1024
- desktop size id:i:4 – 1600 x 1200
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "desktop size id:i:3" |
Desktop height (pixels)
- desktopheight:i:value
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "desktopheight:i:1920" |
Desktop width (pixels)
- desktopwidth:i:value
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "desktopwidth:i:1080" |
Desktop scale factor
- desktopscalefactor:i:100
- desktopscalefactor:i:125
- desktopscalefactor:i:150
- desktopscalefactor:i:175
- desktopscalefactor:i:200
- desktopscalefactor:i:250
- desktopscalefactor:i:300
- desktopscalefactor:i:400
- desktopscalefactor:i:500
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "desktopscalefactor:i:150" |
Define multiple custom RDP properties
To set multiple custom RDP properties, you should use the following command.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "desktopheight:i:1920;desktopwidth:i:1080" |
And verify your changes with the following command.
1 2 3 4 5 | 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.
1 2 3 4 5 | az desktopvirtualization hostpool update --name $hostPoolName \ --resource-group $resourceGroupName \ --custom-rdp-property "" |
Thanks for reading my post. I hope you find it helpful.
Check out this link to learn more about supported RDP settings.