mirror of
https://github.com/jamesstringerparsec/Easy-GPU-PV.git
synced 2024-08-30 18:22:17 +00:00
More pre-checks and auto connect to VM
This commit is contained in:
parent
c9761cc900
commit
c46850299b
@ -4252,9 +4252,15 @@ param(
|
||||
[string]$password,
|
||||
[string]$autologon
|
||||
)
|
||||
|
||||
if (test-path $vhdPath) {
|
||||
Write-Host "Virtual Machine Disk already exists at $vhdPath, please delete existing VHDX or change VMName"
|
||||
Exit
|
||||
}
|
||||
Modify-AutoUnattend -username "$username" -password "$password" -autologon $autologon -hostname $VMName -UnattendPath $UnattendPath
|
||||
$MaxAvailableVersion = (Get-VMHostSupportedVersion).Version | Where-Object {$_.Major -lt 254}| Select-Object -Last 1
|
||||
Convert-WindowsImage -SourcePath $SourcePath -Edition $Edition -VHDFormat $Vhdformat -VHDPath $VhdPath -DiskLayout $DiskLayout -UnattendPath $UnattendPath -GPUName $GPUName -Team_ID $Team_ID -Key $Key -SizeBytes $SizeBytes| Out-Null
|
||||
if (Test-Path $vhdPath) {
|
||||
New-VM -Name $VMName -MemoryStartupBytes $MemoryAmount -VHDPath $VhdPath -Generation 2 -SwitchName "Default Switch" -Version $MaxAvailableVersion | Out-Null
|
||||
Set-VM -Name $VMName -ProcessorCount $CPUCores -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown
|
||||
Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $false
|
||||
@ -4270,6 +4276,14 @@ param(
|
||||
Enable-VMTPM -VMName $VMName
|
||||
Add-VMDvdDrive -VMName $VMName -Path $SourcePath
|
||||
Assign-VMGPUPartitionAdapter -GPUName $GPUName -VMName $VMName -GPUResourceAllocationPercentage $GPUResourceAllocationPercentage
|
||||
Write-Host "INFO : Starting and connecting to VM"
|
||||
vmconnect localhost $VMName
|
||||
}
|
||||
else {
|
||||
Write-Host "Failed to create VHDX, stopping script"
|
||||
Exit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Check-Params @params
|
||||
@ -4279,5 +4293,5 @@ New-GPUEnabledVM @params
|
||||
Start-VM -Name $params.VMName
|
||||
|
||||
Read-Host -Prompt "If all went well the Virtual Machine will have started -
|
||||
you need to approve a certificate install inside the VM
|
||||
via the Hyper-V viewer before connecting via Parsec"
|
||||
you need to accept two certificate install dialogs inside the VM to install a
|
||||
virtual display and virtual audio cable via the Hyper-V viewer then sign into Parsec and connect via Parsec"
|
||||
|
Loading…
Reference in New Issue
Block a user