HomeNewsletterCommunityMVP FeedToolsArchiveBlogToday's NewsAboutServicesQuick Links Subscribe free
← Back to Blog
PowerShell VBScriptPowerShellWindows ActivationslmgrOSLicenseIntuneWindows 11

slmgr.vbs Is Being Deprecated: Replace Windows Activation Scripts with the OSLicense PowerShell Module

IA
Imran Awan
14 September 2026

Every Windows admin has typed cscript slmgr.vbs /ato at least once. It is one of those commands that has been around for so long it feels permanent. It is not. VBScript is being removed from Windows, and slmgr.vbs goes with it. Microsoft now has a direct PowerShell replacement - the OSLicense module - available on devices running the September 2026 servicing update. The window to migrate before things start breaking is open. This post gives you the full playbook.

The short version

Microsoft is removing VBScript from Windows in stages - currently off by default, eventually gone entirely. slmgr.vbs is the most common casualty: it drives activation, key checks, and KMS queries across thousands of runbooks, task sequences, and Intune scripts. The replacement is the OSLicense PowerShell module, available on Windows 11 builds 26100.9278 / 26200.9278 and later (September 2026 update). The migration is a clean swap - three commands cover 90% of use cases. The risk is the dependencies you have not found yet.

The problem: slmgr.vbs will stop working

The symptom you will eventually see looks like this: a Windows activation script that has run reliably for years returns a blank result, an error, or silently does nothing. If your script calls cscript.exe slmgr.vbs /ato or reads output from wscript //E:vbscript, it depends on the Windows Script Host VBScript engine. Once that engine is removed from the OS, those commands produce no output at all - no error, no activation, no log entry. They just stop.

This is not theoretical. VBScript is currently available as a Feature on Demand (FoD) but is no longer installed by default in recent Windows 11 builds. Microsoft has published the full deprecation timeline and is steadily moving toward complete removal. Any workflow that calls slmgr.vbs is on borrowed time.

Critical: slmgr.vbs-based activation failures are silent on devices where VBScript is disabled or removed. The script will appear to run (cscript.exe exits cleanly) but no activation occurs and no error is written to the Application event log. The only signal is a subsequent Get-CimInstance SoftwareLicensingProduct check showing LicenseStatus = 0 (unlicensed) or LicenseStatus = 5 (notification mode).

The most exposed workflows are:

Registry Editor - Software Protection Platform activation state
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform
KeyManagementServiceName REG_SZ kms.contoso.com
KeyManagementServicePort REG_SZ 1688
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation
Manual REG_DWORD 0x00000000 -- automated activation, not manually blocked
NotificationDisabled REG_DWORD 0x00000001 ← suppresses activation toast, masks unlicensed state

Why it happens: VBScript's staged removal from Windows

To understand why slmgr.vbs breaks, you need to understand what it actually is. The file lives at C:\Windows\System32\slmgr.vbs and it is a VBScript file - a plain text script that the Windows Script Host (cscript.exe or wscript.exe) interprets at runtime. The script calls the Software Licensing (SLM) WMI API - specifically the SoftwareLicensingProduct and SoftwareLicensingService WMI classes in the root\CIMV2 namespace.

The underlying WMI classes are not going anywhere. It is the VBScript interpreter itself - the engine that reads and executes .vbs files - that Microsoft is removing. When the VBScript engine is absent, cscript.exe cannot execute any .vbs file, regardless of what it does.

The removal is happening in three phases:

  1. Phase 1 (current): VBScript is disabled by default in Windows 11 24H2 and later. Administrators can re-enable it by installing the VBScript Feature on Demand (FoD). This is the state most organisations are in right now.
  2. Phase 2 (near-term): The FoD remains available but VBScript is removed from the default image entirely. Enabling it requires an explicit action by an administrator.
  3. Phase 3 (final): The FoD is removed. VBScript cannot be installed at all. Any remaining .vbs scripts fail permanently.
Note: The VBScript FoD can be checked with Get-WindowsCapability -Online -Name 'VBSCRIPT*'. A state of NotPresent means VBScript is disabled - slmgr.vbs will not run. A state of Installed means it is currently re-enabled by an administrator, but this is a temporary measure, not a migration strategy.

Why did Microsoft not just rewrite slmgr.vbs as a PowerShell script? Because the activation management surface has been rebuilt around a new PowerShell module - the OSLicense module - which calls the same underlying SLM WMI API directly from PowerShell, with proper error handling and object output instead of the plain-text parsing that made slmgr.vbs output so difficult to work with.

Event Viewer - Microsoft-Windows-Security-SPP/Operational
2026-09-10 09:01:12 Event 12288 - License acquisition in progress
2026-09-10 09:01:14 Event 8198 - License Activation (HWID) failed: 0xC004F074
2026-09-10 09:01:15 Event 16394 - Activation scheduled, retry in 2 hours
2026-09-10 11:01:22 Event 12289 - Confirmed running with genuine software. License status: Licensed

How to verify: find every VBScript activation dependency in your fleet

Before you can migrate, you need to know what you are migrating. slmgr.vbs dependencies are notoriously easy to miss because they often live three layers deep in a ConfigMgr task sequence, a service desk runbook that was never updated, or a scheduled task that fires once a quarter and nobody looks at.

Start with these PowerShell commands to check the current device state:

Audit-VBScriptActivationState.ps1
# Check VBScript FoD status
Get-WindowsCapability -Online -Name 'VBSCRIPT*' |
    Select-Object Name, State

# Check current activation status via CIM (no VBScript needed)
Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" |
    Where-Object { $_.PartialProductKey } |
    Select-Object Name, LicenseStatus, PartialProductKey, GracePeriodRemaining

# Check current OS build (OSLicense requires UBR >= 9278)
$Build = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
"Build: $($Build.CurrentBuildNumber).$($Build.UBR)"

# Test if OSLicense module is available
Get-Command -Name 'Get-OSLicenseInfo' -ErrorAction SilentlyContinue |
    Select-Object Name, Source

For a fleet-wide inventory, use this Microsoft Defender for Endpoint Advanced Hunting KQL query to identify every device that has run cscript.exe or wscript.exe with a .vbs file in the last 30 days:

MDE Advanced Hunting - VBScript activation audit
// VBScript usage audit - slmgr and script host execution
// Timeframe: last 30 days
let lookback = 30d;
DeviceProcessEvents
| where Timestamp > ago(lookback)
| where FileName in~ ("wscript.exe", "cscript.exe")
| where ProcessCommandLine has_any ("slmgr", ".vbs", ".vbe")
    or ProcessCommandLine contains "//E:vbscript"
| summarize
    LastSeen    = max(Timestamp),
    RunCount    = count(),
    Commands    = make_set(ProcessCommandLine, 10)
    by DeviceName, AccountName, FileName
| sort by RunCount desc
Gotcha: The MDE Advanced Hunting query only shows devices that have ALREADY run slmgr.vbs. It will not find scripts that are deployed but have not fired recently - for example, an Intune remediation that triggers monthly on activation failures. The companion audit script Find-VBScriptActivationDependencies.ps1 (see GitHub below) scans the device's file system and scheduled tasks for slmgr references regardless of whether they have recently executed.

Also check these specific locations on your management infrastructure, not just endpoints:

Tip: In the Intune admin center, navigate to Devices › Scripts and remediations › Proactive remediations, export the list, and use PowerShell's Select-String to search for slmgr. You can also use Microsoft Graph: Invoke-MgGraphRequest -Method GET -Uri '/beta/deviceManagement/deviceHealthScripts' | Select-Object -ExpandProperty Value | Where-Object { $_.detectionScriptContent -match 'slmgr' }

The fix: migrate to the OSLicense PowerShell module

The OSLicense module ships as part of Windows 11 starting from the September 2026 servicing update. It requires:

The command mapping is clean. Every common slmgr.vbs task has a direct OSLicense equivalent:

Taskslmgr.vbs (deprecated)OSLicense (replacement)
Activate Windows onlinecscript slmgr.vbs /atoInvoke-OSLicense -ActivateOnline
Install a product keycscript slmgr.vbs /ipk <key>Invoke-OSLicense -InstallProductKey <key>
View license detailscscript slmgr.vbs /dlvGet-OSLicenseInfo
View extended detailscscript slmgr.vbs /dlv allGet-OSLicenseInfo -All
Remove product keycscript slmgr.vbs /upkInvoke-OSLicense -UninstallProductKey
Display expiry datecscript slmgr.vbs /xprGet-OSLicenseInfo (check ExpirationDate)

Here is how a complete activation workflow looks using the new module, with proper error handling that slmgr.vbs never provided:

Invoke-WindowsActivation-OSLicense.ps1
# Confirm OSLicense module is available before attempting activation
$Module = Get-Command -Name 'Get-OSLicenseInfo' -ErrorAction SilentlyContinue
if (-not $Module) {
    Write-Warning "OSLicense module not available on this build. Apply September 2026 update."
    exit 1
}

# Check current license status
$License = Get-OSLicenseInfo
Write-Host "Current status: $($License.LicenseStatus)"

# Only activate if not already licensed
if ($License.LicenseStatus -ne 'Licensed') {
    Write-Host "Triggering online activation..."
    Invoke-OSLicense -ActivateOnline
    # Re-check status after activation attempt
    $NewStatus = (Get-OSLicenseInfo).LicenseStatus
    Write-Host "Post-activation status: $NewStatus"
    if ($NewStatus -eq 'Licensed') {
        Write-Host "Activation successful."
        exit 0
    } else {
        Write-Warning "Activation did not complete. Status: $NewStatus"
        exit 1
    }
} else {
    Write-Host "Device already licensed. No action required."
    exit 0
}

The critical advantage of the OSLicense module over slmgr.vbs is that it returns structured PowerShell objects, not plain text. Your scripts can check $License.LicenseStatus -eq 'Licensed' rather than parsing a string like "License Status: Licensed" from cscript output. Parsing slmgr.vbs output has been a source of bugs for years - the new module eliminates that entirely.

Step-by-step: Deploy replacement activation via Intune (Settings Catalog / Scripts)

  1. Sign in to the Intune admin center at intune.microsoft.com.
  2. Navigate to Devices › Scripts and remediations › Platform scripts.
  3. Select Add › Windows 10 and later.
  4. Give it a name such as "Windows Activation - OSLicense (slmgr.vbs replacement)".
  5. On the Script settings page, upload your Invoke-WindowsActivation-OSLicense.ps1 script. Set Run this script using the logged on credentials to No (run as SYSTEM - activation must run in the SYSTEM context). Set Enforce script signature check per your organisation's code signing policy.
  6. Select Next and assign to the target device group.
Devices Scripts and remediations Platform scripts Add

Deploy this as an Intune Proactive Remediation (OSLicense availability check)

Use the companion Proactive Remediation pair from GitHub to detect which devices in your fleet are not yet on a build that supports OSLicense, and trigger a Windows Update scan to queue the correct patch:

  1. Sign in to the Intune admin center.
  2. Go to Devices › Scripts and remediations › Proactive remediations.
  3. Select Create and name it "VBScript Migration - OSLicense Module Availability Check".
  4. On the Settings page, upload Detect-OSLicenseModuleAvailable.ps1 as the detection script.
  5. Upload Remediate-OSLicenseModuleAvailable.ps1 as the remediation script.
  6. Set Run this script using the logged-on credentials to No (SYSTEM context).
  7. Assign to your Windows 11 device group and set the schedule to Daily.
Devices Scripts and remediations Create

Reference: Software Licensing registry keys for manual verification

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform
Value (type)MeaningHealthy value
KeyManagementServiceName (REG_SZ)KMS server hostname used for volume activationYour KMS FQDN - absent if using HWID/MAK
KeyManagementServicePort (REG_SZ)KMS TCP port1688 (default) - blank if not KMS
SkuId (REG_SZ)Windows SKU GUID from the active licensePopulated GUID matching installed edition
Activation\Manual (REG_DWORD)Blocks automatic activation when set to 10 or absent - 1 blocks all auto-activation
Activation\NotificationDisabled (REG_DWORD)Suppresses Windows activation toast notifications0 or absent - 1 hides activation warnings

Reference: Software Protection Platform Event IDs

Event Viewer › Applications and Services Logs › Microsoft › Windows › Security-SPP › Operational
Event IDLevelMeaning
12288InformationLicense acquisition in progress - activation is attempting to contact the Microsoft activation service or KMS server
12289InformationConfirmed running with genuine software - activation succeeded, license is valid
16384InformationOnline license acquired successfully - device is now licensed
16394WarningActivation scheduled for retry - initial attempt failed, retrying automatically
16385ErrorActivation attempt failed - check subsequent events for the specific error code
8193ErrorLicense Activation (HWID) failed - common during VBScript migration if old scripts are conflicting with new ones
8198ErrorLicense Activation failed with code 0xC004F074 - KMS host not reachable or no KMS host found in DNS
1003InformationSoftware protection service completed - activation service finished its scheduled run
1006InformationLicense validation completed - periodic check passed, no action needed

Proof it worked: confirm OSLicense activated successfully

After deploying the replacement script, verify activation using the OSLicense module itself - no VBScript required. Run the following on a target device to confirm a clean migration:

Verify-OSLicenseActivation.ps1
# Step 1 - Confirm OSLicense module is available
Get-Command Get-OSLicenseInfo -ErrorAction Stop

# Output: CommandType  Name              Version  Source
#         -----------  ----              -------  ------
#         Cmdlet       Get-OSLicenseInfo 1.0.0.0  OSLicense

# Step 2 - Check license status
$Info = Get-OSLicenseInfo
$Info | Select-Object LicenseStatus, ProductName, PartialProductKey, ExpirationDate

# Healthy output:
# LicenseStatus  ProductName                 PartialProductKey  ExpirationDate
# -------------  -----------                 -----------------  --------------
# Licensed       Windows 11 Enterprise       XXXXX              N/A

# Step 3 - Cross-verify via CIM (WMI - the same underlying API)
Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" |
    Where-Object { $_.PartialProductKey } |
    Select-Object LicenseStatus, Name, GracePeriodRemaining
# LicenseStatus 1 = Licensed, 0 = Unlicensed, 5 = Notification mode
Tip: Add Get-OSLicenseInfo as a step in your Intune proactive remediation detection scripts to replace any existing slmgr-based activation checks. The LicenseStatus property returns a string ("Licensed", "Unlicensed", "Notification") rather than an integer code, so your conditions are more readable: if ($Info.LicenseStatus -ne 'Licensed') { exit 1 }

After confirming OSLicense works and VBScript-based scripts have been replaced, check whether the VBScript FoD has been left installed on managed devices. It should be removed once it is no longer needed:

Cleanup-VBScriptFoD.ps1
# Check VBScript FoD status
$FoD = Get-WindowsCapability -Online -Name 'VBSCRIPT*'
$FoD | Select-Object Name, State

# Remove VBScript FoD if it was installed (requires admin / SYSTEM context)
# Only run after confirming all slmgr.vbs dependencies have been migrated
if ($FoD.State -eq 'Installed') {
    Write-Host "Removing VBScript FoD..." -ForegroundColor Yellow
    Remove-WindowsCapability -Online -Name $FoD.Name
    Write-Host "VBScript FoD removed. Reboot may be required." -ForegroundColor Green
} else {
    Write-Host "VBScript FoD is already $($FoD.State). No action needed." -ForegroundColor Green
}
PowerShell Scripts - VBScript/slmgr.vbs Migration

Scripts for this post are in Imran76Awan/Windows-Patching-Scripts. Download and run in your own environment - no sign-in required. All scripts are read-only or trigger only standard Windows Update scans.

Find-VBScriptActivationDependencies.ps1 - audit script: finds slmgr/VBScript references across file system and scheduled tasks, exports CSV
Detect-OSLicenseModuleAvailable.ps1 - Proactive Remediation detection: checks if OSLicense module is available on this build
Remediate-OSLicenseModuleAvailable.ps1 - Proactive Remediation remediation: triggers Windows Update scan to queue the prerequisite patch
View all scripts on GitHub

References

Microsoft MVP community deep-dives

AuthorPostWhat it adds
Mads JohansenVBScript deprecation: Replacement for slmgr.vbsOriginal Sept 2026 writeup that surfaced the OSLicense module and the clean command mapping table used in this post
Was this post helpful?
React below — no account needed
Share this post
LinkedIn X / Twitter Reddit Bluesky

More from EndpointWeekly

PowerShell
PowerShell 7.4 LTS End of Support: Your "Upgrade" to 7.5 Did Not…
PowerShell 7.4 LTS and 7.5 both reach end of support on the same day - November 11, 2026…
Windows 11
Windows 11 KB5124008: September 2026 Patch Tuesday — Deploy and…
KB5124008 patches two actively exploited zero-days in the Windows Update Stack and ALPC.…
Windows 11
Windows Blocks the inpoutx64 RGB Driver After KB5121003 - and…
Microsoft confirmed that RGB lighting and motherboard utility software installing a…