diff --git a/SetupVM.ps1 b/SetupVM.ps1 index c219de3..4dddc27 100644 --- a/SetupVM.ps1 +++ b/SetupVM.ps1 @@ -4,13 +4,14 @@ param( [string]$VMName = "GPU-P", [int64]$MemoryAmount = 8GB, [int]$CPUCores = 4, -[Parameter(Mandatory=$true)][string]$WindowsISOPath = "" +[string]$WindowsISOPath = "C:\Users\james\Downloads\Windows10_InsiderPreview_Client_x64_en-us_21354.iso" ) New-vhd -SizeBytes $HDDSize -Path "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\$VMName.vhdx" -Dynamic New-VM -Name $VMName -MemoryStartupBytes $MemoryAmount -VHDPath "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\$VMName.vhdx" -Generation 2 -SwitchName "Default Switch" - Set-VM -Name $VMName -ProcessorCount $CPUCore -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true + Set-VM -Name $VMName -ProcessorCount $CPUCores -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $false - Add-VMDvdDrive -VMName $VMName -Path $ISOPath + Add-VMDvdDrive -VMName $VMName -Path $WindowsISOPath + Set-VMFirmware -VMName $VMName -BootOrder $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "DVD*"), $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "Hard Drive*"), $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "Network Adapter*") } Function Get-VMGpuPartitionAdapterFriendlyName { @@ -22,8 +23,6 @@ Function Get-VMGpuPartitionAdapterFriendlyName { } - - function Assign-VMGPUPartitionAdapter { param( [string]$VMName, @@ -38,5 +37,5 @@ param( Set-VMGpuPartitionAdapter -VMName $VMName -MinPartitionCompute 0 -MaxPartitionCompute 1000000000 -OptimalPartitionCompute 1000000000 } -Assign-VMGPUPartitionAdapter -GPUName "NVIDIA GeForce RTX 2060 SUPER" -VMName "GPU-P" +#Assign-VMGPUPartitionAdapter -GPUName "NVIDIA GeForce RTX 2060 SUPER" -VMName "GPU-P"