<# .SYNOPSIS Creates a SHA-256 file inventory without changing the source directory. .EXAMPLE ./Get-FileManifest.ps1 -Path ./deployment | ConvertTo-Json | Set-Content ./manifest.json #> [CmdletBinding()] param( [Parameter(Mandatory)][ValidateNotNullOrEmpty()][string]$Path ) $ErrorActionPreference = 'Stop' $manifestRoot = (Resolve-Path -LiteralPath $Path).ProviderPath if (-not (Test-Path -LiteralPath $manifestRoot -PathType Container)) { throw 'Path must point to a directory.' } Get-ChildItem -LiteralPath $manifestRoot -File -Recurse | Where-Object { -not ($_.Attributes -band [IO.FileAttributes]::ReparsePoint) } | Sort-Object FullName | ForEach-Object { [pscustomobject]@{ Path = [IO.Path]::GetRelativePath($manifestRoot, $_.FullName).Replace('\', '/') Bytes = $_.Length SHA256 = (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant() } }