Changing screen resolution of Linux VMs on Hyper-V

When you host Linux VMs on Hyper-V you will very quickly find that changing the default screen resolution is not something that can be done easily. For a default install of a Linux desktop, you will be presented with a resolution of 1024 x 768 which while usable isn't optimal for applications that require higher resolutions.
On a default install of Kali Linux when you go into the Display settings you will find that the Resolution is 1024x768 but when you click the dropdown there are no other options to select from. Thankfully, there is a solution that can be implemented but requires modifying the grub file.

To do this the following steps will need to be taken:

  1. Launch a terminal window and then edit the /etc/default/grub file using your favorite editor:
    sudo nano /etc/default/grub

  2. Find the GRUB_CMDLINE_LINUX_DEFAULT entry and modify the entry as follows:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet video=hyperv_fb:1920x1080"

The 1920 x 1080 can be changed to your preferred screen resolution. The modified file will look like this:
3. Save your edited file and then update GRUB as follows:
sudo update-grub2

4. Reboot once grub has been updated.

Following a reboot, you will be presented with the updated screen resolution specified in the grub file.
It is important to note that you may need to close the Hyper-V VM Connection window and re-launch it for the updated resolution to render properly. Additionally, if you need to change to a different resolution, you must follow the steps above to update to a new resolution and a reboot will be necessary.