Hi sccm t,
The error code 0xC0000022 shown in your PowerShell console (Image 3) means STATUS_ACCESS_DENIED.
You are running the PowerShell script in a standard user session. The commands slmgr (Software Licensing Manager) and Get-WmiObject (accessing system licensing classes) require Administrator privileges.
Additionally, your first Screenshot shows "Kein Product Key gefunden" (No Product Key found). This confirms that your previous attempts (which ran /upk) successfully deleted the Base OS key. You currently have no valid license on the machine, so adding an "Add-on" (ESU) key might fail or behave unpredictably because there is no "Base" license to add it to.
For your MECM deployment and your current test, the script needs to do two things:
Restore the Base Windows 10 Enterprise Key (The standard KMS client key).
Install and Activate the ESU Key.
Here is the final, production-ready script. I have updated it to include the Base OS repair step and automatic Administrator checks.
- ADMIN CHECK: Ensure the script is running with elevated privileges (Required for slmgr)
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Warning "This script must be run as Administrator!"
Exit 1
}
CONFIGURATION: Replace this with your specific ESU Product Key
$esuKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
Standard Windows 10 Enterprise GVLK (Generic Volume License Key) for KMS. This is required to restore the Base OS license you deleted previously.
$baseEnterpriseKey = "NPPR9-FWDCX-D2C8J-H872K-2YT43"
EXECUTION
Phase 1: Restore Base OS License (Fixing the "No Product Key" error)
Write-Host "1. Restoring Base Windows 10 Enterprise KMS Key..." -ForegroundColor Cyan
cscript /nologo $env:SystemRoot\System32\slmgr.vbs /ipk $baseEnterpriseKey
Phase 2: Install the ESU Add-on Key
Write-Host "2. Installing ESU Add-on Key..." -ForegroundColor Cyan
cscript /nologo $env:SystemRoot\System32\slmgr.vbs /ipk $esuKey
Phase 3: Find and Activate ONLY the ESU License
Write-Host "3. Locating ESU Activation ID..." -ForegroundColor Cyan
Using Get-CimInstance (modern replacement for Get-WmiObject) for better MECM compatibility
$esuLicense = Get-CimInstance SoftwareLicensingProduct | Where-Object { $_.Name -like "*Client-ESU-Year1*" -and $_.PartialProductKey }
if ($esuLicense) {
$activationID = $esuLicense.ID
Write-Host " > Found ESU ID: $activationID" -ForegroundColor Green
Write-Host "4. Activating ESU License..." -ForegroundColor Cyan
cscript /nologo $env:SystemRoot\System32\slmgr.vbs /ato $activationID
Phase 4: Final Verification
$finalStatus = (Get-CimInstance SoftwareLicensingProduct | Where-Object { $_.ID -eq $activationID }).LicenseStatus
if ($finalStatus -eq 1) {
Write-Host " > SUCCESS: ESU License is Licensed." -ForegroundColor Green
} else {
Write-Host " > FAILURE: ESU License Status code is $finalStatus" -ForegroundColor Red
}
} else {
Write-Host " > ERROR: ESU License not found. Key installation likely failed." -ForegroundColor Red
}
Optional: Attempt to trigger Base OS KMS activation as well
Write-Host "5. Triggering Base OS KMS Activation..." -ForegroundColor Cyan
cscript /nologo $env:SystemRoot\System32\slmgr.vbs /ato
For your Manual Test: You must right-click the PowerShell script and select "Run as Administrator".
For MECM (SCCM): When you create the Application or Package in MECM, ensure the "Installation Behavior" is set to "Install for System" (not "Install for User"). The SYSTEM account has the necessary permissions to write to WMI and manage licenses.
The Base Key: I included $baseEnterpriseKey = "NPPR9-...". This is the official public Microsoft key for Windows 10 Enterprise KMS clients. It is safe and necessary to use this to repair the machine that currently has "No Product Key".