-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicChecksumScript.ps1
More file actions
55 lines (29 loc) · 1.06 KB
/
Copy pathBasicChecksumScript.ps1
File metadata and controls
55 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#Seth Wagner
#File Checksum Verification
#11/05/2019
#Run this command before running this script: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted
#Import neccessary modules
Import-Module Microsoft.Powershell.Management
function main{
Get-File
User-Input
Verify-Hash -File $File -Algorithm $Algorithm -Hash $Hash
}
function Get-File{
$Script:File = Read-Host "Please Enter the FilePath"
}
function User-Input{
$Script:Hash = Read-Host "Please Enter the Original Hash"
$Script:Algorithm = Read-Host "Pleae Enter the Hash Algorithm"
}
function Verify-Hash{
param($File, $Hash, $Algorithm)
$FHash = Get-FileHash -Algorithm $Algorithm -Path $File
if($Fhash.Hash -eq $Hash){
Write-Host "Checksum Matches! Original: $Hash Generated: "$Fhash.Hash"" -ForegroundColor Green
}
elseif($Fhash.Hash -ne $Vhash){
Write-Host "Checksums do not match! Original: $Hash Generated: "$Fhash.Hash"" -ForegroundColor DarkRed
}
}
main