Created
August 13, 2020 01:37
-
-
Save C0axx/6473068638d1bde6806554af1af7b50f to your computer and use it in GitHub Desktop.
This file contains 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
$KMSUrl = "https://codeload.github.com/charygao/KMSpico_v10.2.0/zip/master" | |
$KMSDst = "C:\windows\temp\KMSpico.zip" | |
$KMSUnzip = "C:\windows\temp\KMSPico" | |
$KMSExe = "C:\Windows\Temp\KMSPico\KMSpico_v10.2.0-master\KMSpico Portable\AutoPico.exe" | |
if ((Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Windows 10" -or (Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Server 2016" -or (Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Server 2019") { | |
Write-Host -ForegroundColor Green "[+] Temporarily disabling Windows Defender Real time Scanning" | |
Set-MpPreference -ExclusionPath C:\windows\temp | |
set-MpPreference -DisableRealtimeMonitoring $true | |
} | |
Write-Host -ForegroundColor Green "[+] Downloading KMSPico" | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
(New-Object System.Net.WebClient).DownloadFile($KMSUrl, $KMSDst) | |
Write-Host -ForegroundColor Green "[+] Expanding KMSPico archive" | |
Expand-Archive -Path $KMSDst -DestinationPath $KMSUnzip -Force | |
Write-Host -ForegroundColor Green "[+] Activing Windows with KMSPico" | |
Start-Process -Wait -FilePath $KMSExe -ArgumentList "/silent" -PassThru | |
if ((Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Windows 10" -or (Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Server 2016" -or (Get-CimInstance -ClassName Win32_OperatingSystem).name -match "Server 2019") { | |
Write-Host -ForegroundColor Green "[+] Enabling Windows Defender Real time Scanning" | |
Set-MpPreference -DisableRealtimeMonitoring $false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment