Get-DfsrFileHash

Get-DfsrFileHash

Gets a file hash.

구문

Parameter Set: Default
Get-DfsrFileHash [-Path] <String[]> [ <CommonParameters>]

자세한 설명

The Get-DfsrFileHash cmdlet gets a hash value identical to the one computed by the DFS Replication service for the specified file or folder during normal replication. Use this cmdlet to determine if you correctly populated a content set, or if a file is in sync between replication partners.

매개 변수

-Path<String[]>

Specifies an array of paths to files or folders. You can use local paths, mapped drives, or UNC paths.

This parameter does not support recursion of subfolders and their contents.

별칭

FullName

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

True (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • string

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • DfsrFileHash

예제

Example 1: Get a file hash

This command uses the Get-DfsrFileHash cmdlet to retrieve the simulated marshaled hash of the file C:\Rf01\Drawing2.vsd.

PS C:\> Get-DfsrFileHash -Path "C:\Rf01\Drawing2.vsd"

Example 2: Retrieve the hash of a folder and its contents

This command uses the Get-DfsrFileHash cmdlet to retrieve the hash of a folder and the hashes for the individual files in the folder.

PS C:\> Get-DfsrFileHash -Path "C:\Rf01\*"

Example 3: Retrieve the hash of a folder and its contents using recursion

This command uses the Get-DfsrFileHash cmdlet to retrieve the hash of a folder and the hashes for the individual files in the folder. The command also uses the Get-ChildItem cmdlet to recursively find all files and folders in the path.

PS C:\> Get-DfsrFileHash -Path (Get-ChildItem -Path c:\Rf01 -Recurse).fullname

Example 4: Retrieve the hash of files with the *.png extension

This command uses the Get-DfsrFileHash cmdlet to retrieve the hash of all files with a *.png extension. The command searches the folder path recursively.

PS C:\> Get-DfsrFileHash -Path (Get-ChildItem -Path c:\Rf01 -Recurse -Filter *.png ).fullname

Example 5: Retrieve and compare file hashes between two replicated folders

This example retrieves and compares simulated file hashes for two replicated folders on different computers.

The first command maps a drive to the replicated folder on the first computer.

The second command uses the Get-DfsrFileHash cmdlet to retrieve the simulated file hashes for the contents of the folder. The command saves the output to a text file.

The third command deletes the mapped drive for the first computer.

The fourth command maps the same drive letter to the replicated folder on the second computer.

The fifth command uses the Get-DfsrFileHash cmdlet to retrieve the simulated file hashes for the contents of the folder. The command saves the output to a text file.

The sixth command deletes the mapped drive for the second computer.

The seventh command uses the Compare-Object cmdlet to compare the two output files and display the results. In this example, the Drawing2.png files differ.

PS C:\> net use x: \\Srv01\c$\Rf01
PS C:\> Get-DfsrFileHash x:\* | Out-File c:\Srv01.txt
PS C:\> net use x: /d
PS C:\> net use x: \\Srv02\e$\data
PS C:\> Get-DfsrFileHash x:\* | Out-File c:\Srv02.txt
PS C:\> net use x: /d
PS C:\> Compare-Object -ReferenceObject (Get-Content C:\Srv01.txt) -DifferenceObject (Get-Content C:\Srv02.txt) -IncludeEqual