Загрузка данных


$Zip = "D:\downloads\PRIME-B460M-A-R2-ASUS-3005.zip"
$Temp = "$env:TEMP\ASUS_B460M_A_R2_3005"
$Recovery = "$env:SystemRoot\Boot\EFI\SecureBootRecovery.efi"

if (-not (Test-Path $Recovery)) {
    throw "SecureBootRecovery.efi не найден. Остановись и пришли эту ошибку."
}

New-Item -ItemType Directory -Force -Path $Temp | Out-Null
Expand-Archive -LiteralPath $Zip -DestinationPath $Temp -Force

$Cap = Get-ChildItem -Path $Temp -Filter "*.CAP" | Select-Object -First 1
if (-not $Cap) {
    throw "Файл CAP в архиве не найден."
}

Copy-Item -LiteralPath $Cap.FullName -Destination "G:\" -Force

New-Item -ItemType Directory -Force -Path "G:\EFI\BOOT" | Out-Null
Copy-Item -LiteralPath $Recovery -Destination "G:\EFI\BOOT\bootx64.efi" -Force

$SourceHash = (Get-FileHash -LiteralPath $Cap.FullName -Algorithm SHA256).Hash
$FlashHash = (Get-FileHash -LiteralPath "G:\$($Cap.Name)" -Algorithm SHA256).Hash

Write-Host "Исходный CAP: $SourceHash"
Write-Host "CAP на флешке: $FlashHash"
Write-Host "Совпадают: $($SourceHash -eq $FlashHash)" -ForegroundColor Green

Get-ChildItem "G:\" -Recurse |
    Select-Object FullName,Length |
    Format-Table -AutoSize