How can I check if Windows is activated from the command prompt or powershell?

A purely PowerShell solution would be:

Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | 
where { $_.PartialProductKey } | select Description, LicenseStatus

This will give you an output like this:

Description                                 LicenseStatus
-----------                                 -------------
Windows(R) Operating System, OEM_DM channel             1

if LicenseStatus is 1, it means that the system is permanently activated.

Good thing about this is, that you can easily check RemoteMachines, by specifying the -ComputerName Parameter.

Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" -ComputerName RemoteComp | 
where { $_.PartialProductKey } | select Description, LicenseStatus

Though I gotta say that slmgr /xpr is faster and also clearer.


On Windows 10 or Windows Server 2016/2019, to display the activation status using the command prompt (or powershell) open your preferred command line tool and enter the following command

slmgr /xpr

a dialog is shown indicating the operating system's activation status. If the operating system is not yet activated, the dialog will indicate it is in 'Notification mode'

Command Prompt with open dialog indicating Windows is in Notification Mode.

If Windows is succesfully activated, the dialog will indicate is is either 'Permanently Activated' as shown below, or if using a time-limited volume license activation the time the activation is due to expire will be shown.

Command Prompt with open dialog indicating Windows is permantently activated.

On older versions of Windows (such as Windows 7) the message dialogs will be similar but may have slightly differing text.

This method could also be useful to check the activation status during the out-of-box experience (OOBE) wizard by using Shift + F10 to launch a command prompt, before completing the wizard.


  • To avoid the popup and
  • store the windows version/activation status in a variable
  • use cscript to run slmgr.vbs and wrap it in a batch file
  • parse output with a for /f loop

:: Q:\Test\2019\04\07\SU_1422368.cmd
@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
Set "WinVerAct="

For /f "tokens=*" %%W in ('
    cscript /Nologo "C:\Windows\System32\slmgr.vbs" /xpr
') Do Set "WinVerAct=!WinVerAct! %%W"
if Not defined WinVerAct ( 
    Echo:No response from slmgr.vbs
    Exit /B 1
)
Echo Windows Version Activation Status:
Echo:"%WinVerAct:~1%"

Sample output:

> Q:\Test\2019\04\07\SU_1422368.cmd
Windows Version Activation Status:
"Windows(R), Professional edition: Der Computer ist dauerhaft aktiviert."

A single line PowerShell script wrapping slmgr.vbs:

$WinVerAct = (cscript /Nologo "C:\Windows\System32\slmgr.vbs" /xpr) -join ''