New-FileCatalog
Creates a Windows catalog file containing cryptographic hashes for files and folders in the specified paths.
语法
Default (默认值)
New-FileCatalog
[-CatalogVersion <Int32>]
[-CatalogFilePath] <String>
[[-Path] <String[]>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
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.
示例
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
参数
-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.
参数属性
类型: | String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 0 |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | 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.
参数属性
类型: | Int32 |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | cf |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Path
Accepts a path or array of paths to files or folders that should be included in the catalog file. If a folder is specified, the command includes all files in the folder.
参数属性
类型: | String[] |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 1 |
必需: | False |
来自管道的值: | True |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | wi |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
输入
String
You can pipe a string that's used as the catalog filename to this cmdlet.
输出
FileInfo
This cmdlet returns a FileInfo object representing the created catalog.
备注
This cmdlet is only available on Windows platforms.