HP Sure Recover User Manual

Generowanie manifestu
Podzielony obraz może obejmować kilka plików, dlatego należy wygenerować manifest za pomocą skryptu
programu PowerShell.
Wszystkie pozostałe czynności należy wykonywać w folderze C:\staging.
CD /D C:\staging
1. Utwórz skrypt programu PowerShell za pomocą edytora, który może wygenerować plik tekstowy w
formacie UTF-8 bez BOM, używając następującego polecenia: notepad C:\staging\generate-
manifest.ps1
Utwórz następujący skrypt:
$mftFilename = "custom.mft"
$imageVersion = 1907 (Uwaga: Może to być 16-bitowa liczba całkowita).
$header = "mft_version=1, image_version=$imageVersion"
Out-File -Encoding UTF8 -FilePath $mftFilename -InputObject $header
$swmFiles = Get-ChildItem "." -Filter "*.swm"
$ToNatural = { [regex]::Replace($_, '\d*\....$',
{ $args[0].Value.PadLeft(50) }) }
$pathToManifest = (Resolve-Path ".").Path
$total = $swmFiles.count
$current = 1
$swmFiles | Sort-Object $ToNatural | ForEach-Object {
Write-Progress
-Activity "Generating manifest" `
-Status "$current of $total ($_)" `
-PercentComplete ($current / $total * 100)
$hashObject = Get-FileHash -Algorithm SHA256 -Path $_.FullName
$fileHash = $hashObject.Hash.ToLower()
$filePath = $hashObject.Path.Replace($pathToManifest + '\', '')
$fileSize = (Get-Item $_.FullName).length
$manifestContent = "$fileHash $filePath $fileSize"
Tworzenie manifestu 7