Whilst running Ubuntu 20.04 in a Windows 10 Hyper-V VM, I found that I could not change the screen resolution. I am not sure what the root cause of the issue was but the following fixed it!
I can't remember why I needed this but the following is helpful:
sudo apt-get install linux-image-extra-virtual
It defaulted to 1024x768, but 1440x900 works better as some dialogs are no longer cropped and it uses more of my monitor, to make the change, do the following:
sudoedit /etc/default/grub
sudo update-grub
sudo reboot
The way to enable this is with PowerShell from the host machine. You need to execute the following command in PowerShell 5.x or 7+:
Set-VMProcessor -VMName
It is worth noting that the Set-VMProcessor
command is in the "hyper-v" module. This module might not be installed, if it is not then you need to add it via the "Add/Remove Windows Features" option in Windows Settings, which is most likely where you installed Hyper-V from in the first place.
Please note that you need to shutdown/power off the VM before using the Set-VMProcessor
command, but once you have subsequently started the VM things like Windows Sandbox should work fine inside the VM. See Run Hyper-V in a Virtual Machine with Nested Virtualization | Microsoft Learn and Set-VMProcessor (Hyper-V) | Microsoft Learn for more information.