HP Sure Recover User Guide
Generování manifestu
Vzhledem k tomu, že součástí rozdělené bitové kopie může být několik souborů, vygenerujte manifest pomocí
skriptu PowerShell.
U všech zbývajících kroků musíte být ve složce C:\staging.
CD /D C:\staging
1. Vytvořte skript PowerShell pomocí editoru, který může vytvořit textový soubor ve formátu UTF-8 bez
BOM, a to pomocí následujícího příkazu: notepad C:\staging\generate-manifest.ps1
Vytvořte následující skript:
$mftFilename = "custom.mft"
$imageVersion = 1907 (Poznámka: Může to být libovolné 16bitové celé číslo)
$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"
Out-File -Encoding utf8 -FilePath $mftFilename -InputObject
$manifestContent -Append
Vytvoření manifestu 7










