HP Sure Recover User Manual

$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
$current = $current + 1
}
附註:
HP Sure Recover 的資訊清單不可包含 BOM,因此以下指令會將檔案重寫為不含 BOM
UTF8
$content = Get-Content $mftFilename
$encoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($pathToManifest + '\' + $mftFilename,
$content, $encoding)
2. 儲存指令碼。
3. 執行指令碼。
powershell .\generate-manifest.ps1
產生資訊清單簽名
Sure Recover 會使用加密簽名驗證代理程式與映像。以下範例使用 X.509 PEM 格式 (.PEM 副檔名) 的私人/
公用金鑰對。視情況調整指令以使用 DER 二位憑證 (.CER .CRT 副檔名)BASE-64 編碼的 PEM 憑證
(.CER .CRT 副檔名) PKCS1 PEM 檔案 (.PEM 副檔名)。範例也使用 OpenSSL,它會以大位元組順序格式
6
2 章 建立公司映像