PowerShell Genie

Copied files have different SHA256 hashes

Incident 1 min read Troubleshooting walkthrough

Documentation: Microsoft Learn

Work the problem

A transfer fails verification

Fictional case: Source and destination have the same filename and size, but their SHA256 hashes differ. The source application was still writing during the copy.

What should you do next?

Reasoning notebook

Record the evidence that supports your answer and the check you would run next. Your notes stay in this browser — nothing is uploaded.

Why it happens

Hashing compares bytes. Incomplete copies, encoding conversion, changed line endings or a file modified after copying can produce different results. Comparing hashes computed with different algorithms is also invalid.

Check this first

1PS> Get-FileHash -LiteralPath '.\source.txt' , '.\copy.txt' -Algorithm SHA256 -ErrorAction Stop | Select-Object Path, Hash

What to look for

Use a stable source so both hashes describe the same version. Then investigate the transfer if they still differ.

Working through it

  1. Confirm that the two literal paths refer to the intended source and copy, and that both results use SHA256.
  2. Check whether an editor or transfer process changed encoding or line endings. Stop active writers before repeating the comparison.
  3. If a fresh copy is appropriate, copy again from the trusted source and recompute both hashes after the copy finishes.

Avoiding it next time

Verify the repair: Compare hashes of the same stable source version and destination, then verify the consuming application can use the file.

Primary documentation

Select-Object reference

Work through the incident

Investigate mismatched file hashes

A copied deployment package has a different SHA256 hash at the destination.

Review the lesson

Genie guideCopied files have different SHA256 hashes

Start with the symptom, then inspect the checks and evidence. These are investigation steps; more than one cause may fit.