Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions HyperV Tools/vm-gpusplit.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
$vm = "Windows GPU"
while($true){
$vm = Read-Host 'Please enter the VM name'
if(Get-VM $vm -ErrorAction SilentlyContinue){ #Checks if entered VM exists
break #Breaks the loop if the VM exists
}else{
Write-Host 'Entered VM does not exist'
}
}
Remove-VMGpuPartitionAdapter -VMName $vm
Add-VMGpuPartitionAdapter -VMName $vm
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionVRAM 1
Expand All @@ -13,7 +20,7 @@ Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionDecode 10
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionCompute 1
Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionCompute 11
Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionCompute 10
Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -GuestControlledCacheTypes $true -VMName $vm #See https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/deploy/deploying-graphics-devices-using-dda
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vm
Set-VM -HighMemoryMappedIoSpace 32GB -VMName $vm
Start-VM -Name $vm
34 changes: 33 additions & 1 deletion HyperV Tools/vm-setresolution.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
Set-VMVideo -VMName 'Ubuntu 20.04' -HorizontalResolution 2560 -VerticalResolution 1440 -ResolutionType Single
while($true){
$vm = Read-Host 'Please enter the VM name'
if(Get-VM $vm -ErrorAction SilentlyContinue){ #Checks if entered VM exists
while($true){
$horizontal = Read-Host 'Please enter the new horizontal resolution of the VM'
Try {
$Null = [convert]::ToInt32($horizontal) #Attempts to convert the input to an integer
$isString = $False
}Catch{$isString = $True} #If the input is not an integer, an error is thrown and $isString is set to true
if($isString){
Write-Host 'Please enter a valid number'
}else{
break #Breaks the inner loop if the input is an integer
}
}
while($true){
$vertical = Read-Host 'Please enter the new vertical resolution of the VM'
Try {
$Null = [convert]::ToInt32($vertical) #Attempts to convert the input to an integer
$isString = $False
}Catch{$isString = $True} #If the input is not an integer, an error is thrown and $isString is set to true
if($isString){
Write-Host 'Please enter a valid number'
}else{
break #Breaks the inner loop if the input is an integer
}
}
break #Breaks the outer loop if the VM exists
}else{
Write-Host 'The VM you entered does not exist'
}
}
Set-VMVideo -VMName $vm -HorizontalResolution $horizontal -VerticalResolution $vertical -ResolutionType Single #Sets the resolution of the VM to the entered values