Forum Discussion
cmautner
3 years agoPuritan
Yes, and I actually, as a matter of habit, offline and re-online prior to mounting and just after mounting as well….. Just from creating custom solutions in many different customer environments as part of Professional Services, every environment behaves differently. This is the most blanket/reliable process I have found.
``` $targetDisk = Get-Disk | Where-Object { $_.serialnumber -eq $diskSerial }
Set-Disk -Number $targetDisk.number -IsOffline $true
Start-Sleep 2
Set-Disk -Number $targetDisk.number -IsOffline $false
Start-Sleep 2
$Partition = Get-Partition -DiskNumber $targetDisk.Number | Where-Object { $_.type -eq 'Basic' }
Add-PartitionAccessPath -PartitionNumber $Partition.PartitionNumber -DiskNumber $targetDisk.Number -AccessPath $osMountPath
Set-Disk -Number $targetDisk.number -IsOffline $true
Start-Sleep 2
Set-Disk -Number $targetDisk.number -IsOffline $false
Start-Sleep 2```