forked from massgravel/Microsoft-Activation-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKMS38_Activation.ps1
25 lines (22 loc) · 949 Bytes
/
KMS38_Activation.ps1
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
# Enable TLSv1.2 if it's not already enabled
if (-not ([System.Net.ServicePointManager]::SecurityProtocol.HasFlag([System.Net.SecurityProtocolType]::Tls12))) {
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12
}
$DownloadURL = 'https://raw.githubusercontent.com/LazyDevv/Hilao/master/KMS38_Activation.cmd'
$FilePath = "$env:TEMP\KMS38_Activation.cmd"
try {
Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile $FilePath
} catch {
Write-Error "Failed to download the file from $DownloadURL. Error: $_"
Return
}
if (Test-Path $FilePath) {
try {
Start-Process $FilePath -Wait
Remove-Item -LiteralPath $FilePath -Force
} catch {
Write-Error "An error occurred while executing or deleting the file. Error: $_"
}
} else {
Write-Error "The downloaded file does not exist at $FilePath."
}