How to change Azure VM Resolution

Hirdesh Baghel 20 Reputation points
2023-10-18T13:36:07.04+00:00

Hi I am having one powershell windows form with hardcoded width and height of 1600 and 950 respectively. This forms displays fine when I am using my local machine(the same machine on which I have developed this form) which is having resolution (1920x1080 and scale setted to 150%). But I am using Azure VM machine having resolution(1280x720 and scale setted to 100%) connected using RDP this windows form got distorted.

I tried changing the resolution with this command

Set-DisplayResolution -Width 1920 -Height 1080

But it didn't worked out. Is there any way using which I can change resololution of my Azure VM so that my Windows Powershell form will render properly.

kindly help and Feel free to provide any suggestions

Thanks in advance !!!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,173 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,708 questions
{count} votes

3 answers

Sort by: Most helpful
  1. TP 100.9K Reputation points
    2023-10-19T07:10:32.5766667+00:00

    Hi Hirdesh,

    Please edit the .rdp file you use to connect to the VM and set it to connect in Full Screen mode, and save the change. In most cases this will cause both resolution and DPI setting to be the same as your local PC. For best results if you are running Windows locally please use mstsc.exe aka Remote Desktop Connection.

    Once the remote session is the same resolution and DPI scaling as your local PC your PowerShell winform should display correctly.

    What operating system version are you running on your local PC? What operating system version is running on the Azure VM?

    Please click Accept Answer if the above was helpful. If something is unclear please add a comment.

    Thanks.

    -TP

    1 person found this answer helpful.

  2. kobulloc-MSFT 26,301 Reputation points Microsoft Employee
    2023-10-18T18:38:28.1566667+00:00

    Hello, @Hirdesh Baghel !

    How do I change the VM's default screen resolution?

    There are two registry values that need to be modified to change your VM's screen resolution (GUID is a randomly generated GUID):

    • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video\GUID\0000\DefaultSettings.XResolution
    • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video\GUID\0000\DefaultSettings.YResolution

    When I tested this out, I did have to create DefaultSettings on my VM however the following PowerShell commands updated the values successfully for 1920x1080:

    
    Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Video\GUID\0000\DefaultSettings' -Name XResolution -Value 1920
    Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Video\GUID\0000\DefaultSettings' -Name YResolution -Value 1080
    

    There is an answer on MSDN from Prasant Chhetri that goes into much more detail:

    https://social.msdn.microsoft.com/Forums/azure/en-US/1c215514-aeef-41d9-b47b-5c838a0bf83f/how-to-change-the-vm-default-screen-resolution?forum=WAVirtualMachinesforWindows


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image


  3. Carlos Quintas 0 Reputation points
    2024-12-19T10:36:45.4433333+00:00

    nao funciona, como é possivel a microsoft ser uma empresa tão grande quando na realidade é uma micro.

    Set-ItemProperty : Cannot find path 'HKLM:\System\CurrentControlSet\Control\Video\GUID\0000\DefaultSettings' because it does not exis

    isto é a vossa solução ????????? são mesmo fraquinhos, acho que o caminho que tem seguido é o mais certo, continuar a imitar o linux, enquanto não imitarem tudo acho que é melhor usar o linux.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.