HP Sure Recover User Guide

    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 なしの UTF-8 としてファイルを書き換えます。
$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
8
2 章 企業用イメージの作成