Skip to content

Instantly share code, notes, and snippets.

@wise-io
Last active February 15, 2022 22:13
Show Gist options
  • Save wise-io/68effd9dbbe3fa45de9e9ac09367709d to your computer and use it in GitHub Desktop.
Save wise-io/68effd9dbbe3fa45de9e9ac09367709d to your computer and use it in GitHub Desktop.
Downloads Malwarebytes Toolset
# https://support.malwarebytes.com/hc/en-us/articles/1500004655761-Download-and-update-the-Malwarebytes-Toolset
param (
[Parameter(Mandatory = $true)]
[string]$RegKey
)
$ArchivePath = "$env:SystemDrive\Utilities\MBTS.zip"
$Toolset = "$env:SystemDrive\Utilities\MBTS"
$DownloadURL = 'https://toolset.malwarebytes.com/file/mbts/' + $RegKey
try {
# Create Directory
if (!(Test-Path (Split-Path $ArchivePath))) { New-Item -ItemType Directory -Force -Path (Split-Path $ArchivePath) }
# Download Malwarebytes Toolset
Invoke-WebRequest -Uri $DownloadURL -OutFile $ArchivePath
# Extract Malwarebytes Toolset
Expand-Archive -Path $ArchivePath -DestinationPath $Toolset -Force
}
catch { throw $Error }
finally {
# Delete Archive
Remove-Item -Path $ArchivePath -Force -ErrorAction Ignore
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment