Here are instructions for verifying the SHA-256 hash of a file using PowerShell:
Click on the Start menu and search for PowerShell.
Right-click on PowerShell and select Run as administrator. This is important to access certain system files.
Locate the file you want to verify.
Obtain the expected SHA-256 hash value for the file. This information is usually provided by the software developer or download source.
There are two ways to use the Get-FileHash cmdlet:
Method A: Using the file path:
In the PowerShell window, type the following command, replacing <file_path> with the actual path to your file:</file_path>
Get-FileHash <file_path> -Algorithm SHA256
Method B: Drag and drop the file:
Navigate to the file location in the File Explorer.
Click and hold the file, then drag it into the PowerShell window.
Release the file, and PowerShell will automatically add the path to the command.
Press Enter to execute the command.
The Get-FileHash command will display the calculated hash value for the file, along with the algorithm used (SHA256 in this case).
Compare the displayed hash value with the expected SHA-256 hash you obtained earlier.
If the two hash values match exactly, the file is considered verified and has not been tampered with.
If the hash values do not match, it indicates that the file has been modified or corrupted, and you should not use it.
Additional notes:
You can also use wildcards with the file path in the Get-FileHash command, for example, Get-FileHash *.exe -Algorithm SHA256 to verify all executable files in the current directory.
For more advanced usage, you can pipe the output of Get-FileHash to other cmdlets for further processing or comparison.