Files

10 lines
614 B
PowerShell

# Вернуть флешку (диск 2) в онлайн после работы ВМ.
$out = 'C:\PF\USBInstaller\test\flash-online.log'
$sp = Join-Path $env:TEMP 'pf-online.txt'
"select disk 2`r`nonline disk`r`nexit`r`n" | Set-Content $sp -Encoding ASCII
$r = & diskpart.exe /s $sp 2>&1
$r | Set-Content $out -Encoding UTF8
Start-Sleep -Seconds 3
Get-Disk -Number 2 | Select-Object Number,OperationalStatus,IsOffline | Format-List | Out-File $out -Append -Encoding UTF8
Get-Partition -DiskNumber 2 | Select-Object PartitionNumber,DriveLetter,Size | Format-Table -AutoSize | Out-File $out -Append -Encoding UTF8