Hi all, i have now created a solution. please note this is only applicable for enterprise users with intune
This is a powershell script to use intune detection and remediation
Just input your MAK key into the remediate script
Detect script
# Detection Script - Check Windows Activation Status
$LogFolder = "C:\Windows\Logs\ActivationRemediation"
$LogFile = Join-Path $LogFolder "ActivationDetect.log"
if (-not (Test-Path $LogFolder)) {
New-Item -ItemType Directory -Path $LogFolder -Force | Out-Null
}
function Write-Log {
param ([string]$Message)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content -Path $LogFile -Value "$Timestamp [DETECT] $Message"
}
Write-Log "Starting detection script."
try {
$Activated = Get-CimInstance -ClassName SoftwareLicensingProduct |
Where-Object { $_.PartialProductKey -and $_.LicenseStatus -eq 1 }
if ($Activated) {
Write-Log "Device is activated. No remediation required."
exit 0 # Compliant
} else {
Write-Log "Device is NOT activated. Remediation required."
exit 1 # Non-compliant
}
} catch {
Write-Log "Exception during detection: $_"
exit 1
}
Remediate script
# Remediation Script - Reapply MAK Key and Reactivate Windows
$MAKKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
$LogFolder = "C:\Windows\Logs\ActivationRemediation"
$LogFile = Join-Path $LogFolder "ActivationRemediate.log"
if (-not (Test-Path $LogFolder)) {
New-Item -ItemType Directory -Path $LogFolder -Force | Out-Null
}
function Write-Log {
param ([string]$Message)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content -Path $LogFile -Value "$Timestamp [REMEDIATE] $Message"
}
Write-Log "Starting remediation script."
try {
Write-Log "Installing MAK key..."
$ipk = cscript.exe /nologo C:\Windows\System32\slmgr.vbs /ipk $MAKKey 2>&1
Write-Log "Key installation output: $ipk"
Start-Sleep -Seconds 5
Write-Log "Triggering online activation..."
$ato = cscript.exe /nologo C:\Windows\System32\slmgr.vbs /ato 2>&1
Write-Log "Activation output: $ato"
Start-Sleep -Seconds 5
$Activated = Get-CimInstance -ClassName SoftwareLicensingProduct |
Where-Object { $_.PartialProductKey -and $_.LicenseStatus -eq 1 }
if ($Activated) {
Write-Log "Activation successful."
} else {
Write-Log "Activation failed. License status still non-compliant."
}
} catch {
Write-Log "Exception during remediation: $_"
}
===================================
the scripts can be deployed and set to run very day or as little as every hr Just deploy to the relevant device group.
Hope this helps you out, sorry no solution for ppl with OEM licence issues