CmdID / PowerShell / Cmdlets / Test
Test-FileCatalog
Test-FileCatalog validates whether the hashes contained in a catalog file (.cat) matches the hashes of the actual files in order to validate their authenticity. PowerShell reference
From the PowerShell reference 6 parameters
What it does
Test-FileCatalog validates whether the hashes contained in a catalog file (.cat) matches the hashes of the actual files in order to validate their authenticity. This cmdlet is only supported on Windows. Test-FileCatalog validates the authenticity of files by comparing the file hashes of a catalog file (.cat) with the hashes of actual files on disk. If it detects any mismatches, it returns the status as ValidationFailed. Users can retrieve all this information by using the -Detailed parameter. It also displays signing status of catalog in Signature property, which is equivalent to calling Get-AuthenticodeSignature cmdlet on the catalog file. Users can also skip any file during validation by using the -FilesToSkip parameter. IMPORTANT: Version 1.0 (SHA1-based) catalogs are deprecated and shouldn't be trusted for security-sensitive workflows. This cmdlet is only supported on Windows.
Test-FileCatalog [-Detailed] [-FilesToSkip <String[]>] [-CatalogFilePath] <String> [[-Path] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Create and validate a file catalog
$NewFileCatalogParams = @{
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility"
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
CatalogVersion = 2.0
}
New-FileCatalog @NewFileCatalogParams
$TestFileCatalogParams = @{
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
}
Test-FileCatalog @TestFileCatalogParamsIdentifyValidate a file catalog with detailed output
$TestFileCatalogParams = @{
Detailed = $true
CatalogFilePath = "\temp\Microsoft.PowerShell.Utility.cat"
Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility\"
}
Test-FileCatalog @TestFileCatalogParamsIdentifyIts page in the reference: Test-FileCatalog.
Parameters
-CatalogFilePathA path to a catalog file (.cat) that contains the hashes to be used for validation.-DetailedReturns more information a more detailed CatalogInformation object that contains the files tested, their expected/actual hashes, and an Authenticode signature of the catalog file if it's signed.-FilesToSkipAn array of paths that should not be tested as part of the validation.-PathA folder or array of files that should be validated against the catalog file.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.