If I want to check whether Windows is activated, but I can't be bothered to dive into the menu system or am on a version of Windows without Desktop Experience (such as Server Core), how can I check the activation status using only the command line?

4 Answers 4


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.

  • Are the different numbers documented somewhere? Aug 23, 2020 at 22:17
  • Or Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%' and partialproductkey <> null"
    – js2010
    Jul 29, 2022 at 15:08
  • Is there a way to get the expiration date?
    – js2010
    Jul 29, 2022 at 15:20
  • 2
    This will save you 14 seconds. Get-CimInstance SoftwareLicensingProduct -Filter "partialproductkey is not null" | ? name -like windows*
    – js2010
    Jul 29, 2022 at 15:33

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.

  • This answer does not work on systems without a GUI, which was an explicit part of the question. If you're running Server Core or are connecting remotely to a headless system, slmgr will return no results or appear to hang. This does work fine for most desktop users, however.
    – Thomas
    Aug 8, 2023 at 17:19
  • 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:

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 ''
  • 1
    and (as a little cherry on top) Invoke-Command { (cscript /Nologo "C:\Windows\System32\slmgr.vbs" /xpr) -join '' } -ComputerName xy to check remote machines in PowerShell
    – SimonS
    Apr 11, 2019 at 10:16

You can also do

SELECT LicenseStatus FROM SoftwareLicensingProduct

as a WMI query, where values are:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .