# Compare SHA-256 hashes in two explicitly selected folders. Never changes files. [CmdletBinding()] param( [string]$Source = (Join-Path $PSScriptRoot '../data/restore-source'), [string]$Restored = (Join-Path $PSScriptRoot '../data/restore-result') ) $ErrorActionPreference = 'Stop' $sourceRoot = (Resolve-Path -LiteralPath $Source).Path $restoreRoot = (Resolve-Path -LiteralPath $Restored).Path foreach ($file in (Get-ChildItem -LiteralPath $sourceRoot -File -Recurse)) { $relative = $file.FullName.Substring($sourceRoot.Length).TrimStart([char[]]'\/') $target = Join-Path $restoreRoot $relative $status = 'Missing' if (Test-Path -LiteralPath $target -PathType Leaf) { $original = (Get-FileHash -LiteralPath $file.FullName -Algorithm SHA256).Hash $restoredHash = (Get-FileHash -LiteralPath $target -Algorithm SHA256).Hash $status = if ($original -eq $restoredHash) { 'Match' } else { 'Mismatch' } } [pscustomobject]@{ File = $relative; Status = $status } } # This checks expected file contents only, not ACLs, extra files or application recovery.