This commit is contained in:
James Stringer 2021-11-21 05:40:09 -08:00
parent eea81c5491
commit c552b1817c

View File

@ -68,34 +68,34 @@ foreach ($d in $drivers) {
}
$VM = Get-VM -VMName "GPUP"
$VHD = Get-VHD -VMId $VM.VMId
If ($VM.state -eq "Running") {
[bool]$state_was_running = $true
}
[bool]$state_was_running = $true
}
if ($VM.state -ne "Off"){
"Attemping to shutdown VM..."
Stop-VM -Name $VMName -Force
}
"Attemping to shutdown VM..."
Stop-VM -Name $VMName -Force
}
While ($VM.State -ne "Off") {
Start-Sleep -s 3
"Waiting for VM to shutdown - make sure there are no unsaved documents..."
}
$VHD = Get-VHD -VMId $VM.VMId
Start-Sleep -s 3
"Waiting for VM to shutdown - make sure there are no unsaved documents..."
}
"Mounting Drive..."
$DriveLetter = (Mount-VHD -Path $VHD.Path -PassThru | Get-Disk | Get-Partition | Get-Volume | Where-Object {$_.DriveLetter} | ForEach-Object DriveLetter) + ":"
"Copying GPU Files - this could take a while..."
Add-VMGPUPartitionAdapterFiles -hostname $Hostname -DriveLetter $DriveLetter -GPUName $GPUName
"Dismounting Drive..."
Dismount-VHD -Path $VHD.Path
If ($state_was_running){
"Previous State was running so starting VM..."
Start-VM $VMName
}
"Previous State was running so starting VM..."
Start-VM $VMName
}
"Done..."