This project is read-only.

Get-MSIFileHash

Synopsis

Gets a hash of a file in a Windows Installer-compatible format.

Syntax

  • Get-MSIFileHash &#91;-Path&#93; <String[]> &#91;-PassThru&#93;
  • Get-MSIFileHash &#91;-LiteralPath&#93; <String[]> &#91;-PassThru&#93;

Detailed 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 MSIHashPart1, MSIHashPart2, MSIHashPart3, and MSIHashPart4 properties to FileSystem items.

Parameters

-Path <String[]>

Specifies the path to the item or items which must resolve to a file system path.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? true

-PassThru

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

-LiteralPath <String[]>

Specifies 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? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

Return Type

  • Microsoft.Windows.Installer.FileHashInfo: If -passthru is not specified, Get-MSIFileHash returns an object of type Microsoft.Windows.Installer.FileHashInfo.

Notes

Example 1

C:\PS> get-msifilehash -path * | format-table -auto

This command outputs the file hash of every file in the current directory as a table.

Example 2

C:\PS> 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

Last edited Feb 8, 2009 at 8:19 PM by heaths, version 3

Comments

No comments yet.