Created
August 28, 2022 10:41
-
-
Save jsfag/a1d6c3431721a60d6388d48f81f84b15 to your computer and use it in GitHub Desktop.
Enable and disable GPU partition (edit for your PCI addresses and VM name).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to name of TARGET-VM. | |
$vm='win10' | |
# Change to PCI device location (π‘ Location). | |
$Location = 'PCIROOT(0)#PCI(0301)#PCI(0000)#PCI(0000)#PCI(0000)' | |
Remove-VMAssignableDevice -LocationPath $locationPath -VMName $vm | |
Mount-VMHostAssignableDevice -LocationPath $locationPath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to name of TARGET-VM. | |
$vm='win10' | |
# Change to PCI device location (π‘ Location). | |
$Location = 'PCIROOT(0)#PCI(0301)#PCI(0000)#PCI(0000)#PCI(0000)' | |
# Enable CPU features. | |
Set-VM -GuestControlledCacheTypes $true -VMName $vm | |
# Host-Shutdown rule must be changed for the VM. | |
Set-VM -Name $vm -AutomaticStopAction TurnOff | |
# Change size to fit your requirements ("π‘ Min required MMOU Space"). | |
# (See https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/plan-for-deploying-devices-using-discrete-device-assignment#mmio-space) | |
#Set-VM -LowMemoryMappedIoSpace 3Gb -VMName $vm # 32bit | |
Set-VM -HighMemoryMappedIoSpace 6Gb -VMName $vm # 64bit | |
# Dismount device | |
Dismount-VMHostAssignableDevice -LocationPath $Location | |
Dismount-VMHostAssignableDevice -force -LocationPath $Location | |
Add-VMAssignableDevice -LocationPath $Location -VMName $vm | |
# Try start the VM in Hyper-V manager. | |
# β Starting fails with: "A hypervisor feature is not available to the user." β | |
# See: https://social.technet.microsoft.com/Forums/ie/en-US/a7c2940a-af32-4dab-8b31-7a605e8cf075/a-hypervisor-feature-is-not-available-to-the-user?forum=WinServerPreview | |
# Reboot host. | |
bcdedit /set hypervisoriommupolicy enable | |
Restart-Computer -Confirm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment