HP Sure Recover User Guide
$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
$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
매니페스트 만들기 7