HyperV Ubuntu virtual machine open enhanced session adjust resolution enable clipboard

Enhanced sessions are enabled by default on Windows-based virtual machines under HyperV. In the enhanced session, the clipboard and files can be easily shared with the host computer, and the resolution can be easily adjusted when the enhanced session is opened. In Linux systems such as Ubuntu, the default is a basic session, and the resolution adjustment needs to modify the boot file, and the clipboard and the host are independent, which is very inconvenient.

After searching, I found a method to open an enhanced session under Ubuntu 20.04. It is effective after using it, so I record it here.

If you need to open the enhanced session first, you must first enable the second-generation virtual machine option when creating the virtual machine, and turn off Secure Boot when it is first started. Remember not to enable the automatic login option when installing Ubuntu.

Type in the terminal

% wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh % sudo chmod +x install.sh % sudo ./install.sh

Run the following commands in Windows Power Shell and reboot.

> Set-VM -VMName -EnhancedSessionTransportType HvSocket

After restarting, you can see the XRDP login page that Ubuntu enters after the session has been in enhanced session mode after linking the virtual machine. At this time, you can enter the username and password normally.