Update for 24.04
The newer 24.04 version does well with ONLY the powershell command below to configure the virual machine, and does NOT need the grub line modification. If you do edit grub, you may very well end up with a completely black screen and only an X cursor. In that case, use CTRL-ALT-F3 to start a text based session, and remove the grub edit.
Original document:
This is the more pratical and quick way to set a default resolution for say a Linux desktop version installation under hyper-v:
- – Start a powershell session as administrator
- – Find your Virtual machine’s name, and run the command below substituting ‘VMName’ for the desired Vm Target.
- – Substitute the 1440 and 900 for your desired resolution
set-vmvideo VMName -horizontalresolution:1440 -verticalresolution:900 -resolutiontype single
Depending on how modern your distribution is, there may be more work to do. If you are still stuck on the default 1024×768, make the following changes on the Linux guest:
# sudo nano /etc/default/grub
Now change the value of GRUB_CMDLINE_LINUX_DEFAULT as below. Again, change the 1440×900 to your desired resolution.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1440x900"
Next, update grub, add optional drivers, and reboot.
# sudo update-grub
# sudo apt install linux-image-extra-virtual
# shutdown now -r
As a final step, if you have a large HD display you may want to set scaling. You do this once again on the guest, replacing the scaling factor 2 below with whatever factor you want.
gsettings set org.gnome.desktop.interface scaling-factor 2