Skip to content
Open
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
14 changes: 12 additions & 2 deletions Update-VMGpuPartitionDriver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ While ($VM.State -ne "Off") {
}

"Mounting Drive..."
$DriveLetter = (Mount-VHD -Path $VHD.Path -PassThru | Get-Disk | Get-Partition | Get-Volume | Where-Object {$_.DriveLetter} | ForEach-Object DriveLetter)
$mnt = Mount-VHD -Path $VHD.Path -PassThru
Start-Sleep -Seconds 3
$disk = $mnt | Get-Disk
if ($disk.IsOffline) { Set-Disk -Number $disk.Number -IsOffline $false }
$part = $disk | Get-Partition | Sort-Object Size -Descending | Select-Object -First 1
if ($part.DriveLetter -notmatch '^[A-Z]$') {
$part | Add-PartitionAccessPath -AssignDriveLetter -ErrorAction SilentlyContinue | Out-Null
Start-Sleep -Seconds 3
$part = $disk | Get-Partition | Sort-Object Size -Descending | Select-Object -First 1
}
$DriveLetter = "$($part.DriveLetter):"

"Copying GPU Files - this could take a while..."
Add-VMGPUPartitionAdapterFiles -hostname $Hostname -DriveLetter $DriveLetter -GPUName $GPUName
Expand All @@ -49,4 +59,4 @@ If ($state_was_running){
Start-VM $VMName
}

"Done..."
"Done..."