Skip to content

Latest commit

 

History

History
178 lines (131 loc) · 4.83 KB

File metadata and controls

178 lines (131 loc) · 4.83 KB
external help file Microsoft.PowerShell.Security.dll-Help.xml
Locale en-US
Module Name Microsoft.PowerShell.Security
ms.date 03/05/2026
online version https://learn.microsoft.com/powershell/module/microsoft.powershell.security/new-filecatalog?view=powershell-7.6&WT.mc_id=ps-gethelp
schema 2.0.0
title New-FileCatalog

New-FileCatalog

SYNOPSIS

Creates a Windows catalog file containing cryptographic hashes for files and folders in the specified paths.

SYNTAX

New-FileCatalog [-CatalogVersion <Int32>] [-CatalogFilePath] <String> [[-Path] <String[]>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

This cmdlet is only available on the Windows platform.

New-FileCatalog creates a Windows catalog file for a set of folders and files. This catalog file contains hashes for all files in the provided paths. Users can then distribute the catalog with their files so that users can validate whether any changes have been made to the folders since catalog creation time.

Catalog versions 1 and 2 are supported. Version 1 uses the (deprecated) SHA1 hashing algorithm to create file hashes, and version 2 uses SHA256.

EXAMPLES

Example 1: Create a file catalog for Microsoft.PowerShell.Utility

$newFileCatalogSplat = @{
    Path = "$PSHOME\Modules\Microsoft.PowerShell.Utility"
    CatalogFilePath = '\temp\Microsoft.PowerShell.Utility.cat'
    CatalogVersion = 2.0
}
New-FileCatalog @newFileCatalogSplat
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         11/2/2018 11:58 AM            950 Microsoft.PowerShell.Utility.cat

PARAMETERS

-CatalogFilePath

The location and name of the catalog file (.cat) you are creating. If you specify only a folder path, the command creates a file named catalog.cat in that location.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-CatalogVersion

Accepts 1.0 or 2.0 as possible values for specifying the catalog version. 1.0 should be avoided whenever possible because it uses the insecure SHA-1 hash algorithm. Version 2.0 uses the secure SHA-256 algorithm.

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

Accepts a path or array of paths to files or folders that should be included in the catalog file. When you specify a folder, the command enumerates the contents of the folder recursively to include all subfolders and their contents. The catalog file contains relative paths to the files included in the catalog.

Important

When you provide a list of files or folders, the cmdlet can't compute a relative path since the files and folders can be anywhere on the filesystem. Under this condition, the cmdlet only uses the filename for the hash, which means that you can't have duplicate filenames in different paths. For the best results, pass in a single folder and let the cmdlet enumerate the contents. The cmdlet uses that initial path to calculate relative paths so that duplicate filenames are still unique within the folder tree.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

You can pipe a string that's used as the catalog filename to this cmdlet.

OUTPUTS

System.IO.FileInfo

This cmdlet returns a FileInfo object representing the created catalog.

NOTES

This cmdlet is only available on Windows platforms.

RELATED LINKS

Test-FileCatalog

PowerShellGet