Created
March 18, 2021 13:52
-
-
Save andrewodri/04b63bd6d49e59c2007a1508d39c4fa7 to your computer and use it in GitHub Desktop.
Download, validate and expand archive using PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ArchiveHash = '2c1ab54ac560327ed45fdc28a106d539' | |
New-Item -ItemType Directory -Path '/tmp' | |
(New-Object System.Net.WebClient).DownloadFile('https://example.com/archive.zip', '/tmp/archive.zip'); | |
if ( ( Get-FileHash -Path '/tmp/archive.zip' -Algorithm MD5 ).Hash -eq $ArchiveHash ) { Write-Output 'Could not validate hash.' } else { exit } | |
Expand-Archive -Path '/tmp/archive.zip' -DestinationPath '/tmp' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment