Skip to content

Latest commit

 

History

History
123 lines (95 loc) · 2.61 KB

Compare-FileHash.md

File metadata and controls

123 lines (95 loc) · 2.61 KB
Author external help file Module Guid Module Name online version schema
Paul Boyer
psvault-Utilities-help.xml
0ba23f80-06be-4ccc-a218-05969d5e5b5e
psvault-Utilities
2.0.0

Compare-FileHash

SYNOPSIS

Quick script to compare file hashes of contents between two directories

SYNTAX

Compare-FileHash [-DifferenceDirectory] <String> [-ReferenceDirectory] <String> [[-Algorithm] <String>]
 [[-Recurse] <ParameterAttribute>] [[-Path] <String>] [<CommonParameters>]

DESCRIPTION

Script get the child items in each directory (recursing if necessary) and then hashes each file. Then the two sets of file hashes are compared using Compare-Object. The results can be piped out to a file.

EXAMPLES

EXAMPLE 1

Compare-FileHash -ReferenceDirectory C:\Windows -DifferenceDirectory D:\Windows -Recurse

PARAMETERS

-DifferenceDirectory

Path to the directory to compare as the right operand (=>)

Type: String
Parameter Sets: (All)
Aliases:

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

-ReferenceDirectory

Path to the directory to compare as the left operand (<=)

Type: String
Parameter Sets: (All)
Aliases:

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

-Algorithm

String parameter for which algorithm to use to compute hashes. Accepted values are SHA1, SHA256, SHA384, SHA512, MD5

Type: String
Parameter Sets: (All)
Aliases:

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

-Recurse

Switch parameter that will cause the reference and difference directories to recurse through all files, not just at the depth that was passed

Type: ParameterAttribute
Parameter Sets: (All)
Aliases:

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

-Path

Path to the output file

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
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

OUTPUTS

A .txt file with results of the comparison operations piped out using Tee-Object

NOTES

RELATED LINKS