Windows Activation and Edition Change
Activation Script
$TaskName = 'Activate MAK Windows 10 Enterprise'
$MakKey = 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'
#======================================================================================
# Logs
#======================================================================================
$TaskLogs = "$env:SystemRoot\Logs\Activation"
if (!(Test-Path $TaskLogs)) {New-Item $TaskLogs -ItemType Directory -Force | Out-Null}
$TaskLogName = "$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-$TaskName.log"
Start-Transcript -Path (Join-Path $TaskLogs $TaskLogName)
#======================================================================================
# Operating System
#======================================================================================
$OSCaption = $((Get-WmiObject -Class Win32_OperatingSystem).Caption).Trim()
$OSArchitecture = $((Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture).Trim()
$OSVersion = $((Get-WmiObject -Class Win32_OperatingSystem).Version).Trim()
$OSBuildNumber = $((Get-WmiObject -Class Win32_OperatingSystem).BuildNumber).Trim()
#======================================================================================
# Variables
#======================================================================================
Write-Host "OSCaption: $OSCaption" -ForegroundColor Cyan
Write-Host "OSArchitecture: $OSArchitecture" -ForegroundColor Cyan
Write-Host "OSVersion: $OSVersion" -ForegroundColor Cyan
Write-Host "OSBuildNumber: $OSBuildNumber" -ForegroundColor Cyan
#======================================================================================
# Set SLMGR
#======================================================================================
if (Test-Path "$env:windir\SYSWOW64\slmgr.vbs") {
$slmgr = "$env:windir\SYSWOW64\slmgr.vbs"
} else {
$slmgr = "$env:windir\System32\slmgr.vbs"
}
#======================================================================================
# OS Activation
#======================================================================================
if (Test-Path $slmgr) {
Write-Host "**********************"
Write-Host "Display Licensing Information"
Write-Host "Command Line: cscript //nologo $slmgr /dlv"
cscript //nologo $slmgr /dlv
Write-Host "**********************"
Write-Host "Install Product Key"
Write-Host "Command Line: cscript //nologo $slmgr /ipk $MakKey"
cscript //nologo $slmgr /ipk $MakKey
Write-Host "**********************"
Write-Host "Activate Windows"
Write-Host "Command Line: cscript //nologo $slmgr /ato"
cscript //nologo $slmgr /ato
Write-Host "**********************"
Write-Host "Display Licensing Information"
Write-Host "Command Line: cscript //nologo $slmgr /dlv"
cscript //nologo $slmgr /dlv
Write-Host "**********************"
Write-Host "Display Installation ID for Offline Activation"
Write-Host "Command Line: cscript //nologo $slmgr /dti"
cscript //nologo $slmgr /dti
}
Write-Host "**********************"
Write-Warning "Internet access may be required to complete activation"
#======================================================================================
# Complete
#======================================================================================
Stop-TranscriptInception

Create the Task


Standard User Testing





GitHub
Last updated

