< Back
Get-MSIFileHash
Post
NAME Get-MSIFileHash
SYNOPSIS
Gets a hash of a file in a Windows Installer-compatible format.
SYNTAX
Get-MSIFileHash -LiteralPath <String[]> [-PassThru] [<CommonParameters>]
Get-MSIFileHash [[-Path] <String[]>] [-PassThru] [<CommonParameters>]
DESCRIPTION
Get-MSIFileHash returns a 128-bit file hash in 4 separate parts, compatible with columns in the MsiFileHash table
in Windows Installer packages. All non-versioned files should contain this hash.
You can optionally add these HashPart1, HashPart2, HashPart3, and HashPart4 properties to FileSystem items.
PARAMETERS
-LiteralPath <String[]>
The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used
exactly as typed. No characters are interpreted as wildcards.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Passes the item or items passed into this cmdlet through the pipeline with additional properties for the file
hash.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String[]>
The path to the item or items which must resolve to a file system path. You can specify * in any part of the
path to select all matching files.
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? true
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Microsoft.Tools.WindowsInstaller.FileHash
System.IO.DirectoryInfo
System.IO.FileInfo
NOTES
-------------------------- EXAMPLE 1 --------------------------
get-msifilehash -path * | format-table -auto
This command outputs the file hash of every file in the current directory as a table.
-------------------------- EXAMPLE 2 --------------------------
get-childitem | where-object {$_.PSIsContainer -eq $False} | get-msifilehash -passthru | format-table Name, MSI*
-auto
This command outputs the name and hash parts of each file in the current directory.
RELATED LINKS
Get-MSIFileType
SYNOPSIS
Gets a hash of a file in a Windows Installer-compatible format.
SYNTAX
Get-MSIFileHash -LiteralPath <String[]> [-PassThru] [<CommonParameters>]
Get-MSIFileHash [[-Path] <String[]>] [-PassThru] [<CommonParameters>]
DESCRIPTION
Get-MSIFileHash returns a 128-bit file hash in 4 separate parts, compatible with columns in the MsiFileHash table
in Windows Installer packages. All non-versioned files should contain this hash.
You can optionally add these HashPart1, HashPart2, HashPart3, and HashPart4 properties to FileSystem items.
PARAMETERS
-LiteralPath <String[]>
The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used
exactly as typed. No characters are interpreted as wildcards.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Passes the item or items passed into this cmdlet through the pipeline with additional properties for the file
hash.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String[]>
The path to the item or items which must resolve to a file system path. You can specify * in any part of the
path to select all matching files.
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? true
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Microsoft.Tools.WindowsInstaller.FileHash
System.IO.DirectoryInfo
System.IO.FileInfo
NOTES
-------------------------- EXAMPLE 1 --------------------------
get-msifilehash -path * | format-table -auto
This command outputs the file hash of every file in the current directory as a table.
-------------------------- EXAMPLE 2 --------------------------
get-childitem | where-object {$_.PSIsContainer -eq $False} | get-msifilehash -passthru | format-table Name, MSI*
-auto
This command outputs the name and hash parts of each file in the current directory.
RELATED LINKS
Get-MSIFileType