massgrave.dev/get-mas.ps1

35 lines
870 B
PowerShell
Raw Normal View History

2022-04-10 16:39:54 +02:00
function Exit-Script {
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[int]
$ExitCode = 0
)
process {
2022-04-28 19:00:09 +02:00
if (Test-Path -Path "$env:TEMP\MAS.cmd") {
Remove-Item -Path "$env:TEMP\MAS.cmd" -Force
2022-04-10 16:39:54 +02:00
}
exit $ExitCode
}
}
# Enable TLSv1.2 and TLSv1.3 for compatibility with older clients
$TLS12Protocol = [System.Net.SecurityProtocolType] 'Tls12', 'Tls13'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol
$DownloadURL = 'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/MAS/All-In-One-Version/MAS_1.5_AIO_CRC32_21D20776.cmd'
try {
Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile "$env:TEMP\MAS.cmd"
} catch {
Write-Error $_
Exit-Script -ExitCode 1
}
Start-Process -FilePath "$env:TEMP\MAS.cmd" -Wait
Exit-Script