Windows 下 Hyper-V 虚拟机的一些记录

Install Windows 11 in Hyper-V

  1. Check if the Hyper-V Windows feature is installed
  2. Create a new VM for Windows 11
    • Specify Generation choose Generation 2
    • After the VM is created, start VM. Will get boot fail error!
    • Turn off VM.
    • Then right click on it and go to Settings, Open Security tab and make sure Enable Secure Boot are not selected and Enable Trusted Platform Module are selected.
    • Connect to VM, then you can install Win11.

中文渲染问题

英文版的 win11 默认渲染中文会使用日文,导致文字变形,需要一些额外的设置来让文字显示正常。

打开 Settings -> Time & language -> Related settings -> Administrative language settings -> Administrative Tab -> Change system locale -> Current system locale Chinese (Simplified, China)

Hyper-V 下显卡虚拟化 vGPU 设置

  • Run belong script with administrator privilege.
powershell
1
2
3
4
5
6
7
8
9
$vm = "virtual machine name"

Add-VMGpuPartitionAdapter -VMName $vm

Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionVRAM 80000000 -MaxPartitionVRAM 100000000 -OptimalPartitionVRAM 100000000 -MinPartitionEncode 80000000 -MaxPartitionEncode 100000000 -OptimalPartitionEncode 100000000 -MinPartitionDecode 80000000 -MaxPartitionDecode 100000000 -OptimalPartitionDecode 100000000 -MinPartitionCompute 80000000 -MaxPartitionCompute 100000000 -OptimalPartitionCompute 100000000

Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vm
Set-VM -HighMemoryMappedIoSpace 32GB -VMName $vm
  • Copy Host machine C:\Windows\System32\DriverStore\FileRepository\ to Virtual machine C:\Windows\System32\HostDriverStore\FileRepository\.
  • Copy Host machine C:\Windows\System32\nvapi64.dll to Virtual machine same path.
  • Press Win + R and type dxdiag to check.

RDP 开启 GPU 加速

  1. Press Win + R and type gpedit.msc.
  2. Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Remote Session Environment
    • Select it, then double click Use hardware graphics adapters for all Remote Desktop Services sessions and edit value to Enabled.

解决几个快捷键冲突

Settings Location: Settings -> Time & language -> Language & region -> Language tab -> Chinese (Simplified, China) -> Language options -> Keyboards -> Microsoft Pinyin -> Keyboard options -> Keys -> Mode Switch -> ...

  1. Ctrl + Space Chinese/English mode switch
  2. Ctrl + Shift + F Simplified/Traditional Chinese input switch