<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matthew J. Moore</title>
    <description>The latest articles on DEV Community by Matthew J. Moore (@krbkeys).</description>
    <link>https://dev.to/krbkeys</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4226760%2Fefa4b8a9-fdd9-4d34-9122-5efaf7da11d7.png</url>
      <title>DEV Community: Matthew J. Moore</title>
      <link>https://dev.to/krbkeys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krbkeys"/>
    <language>en</language>
    <item>
      <title>The slmgr commands I actually use to debug Windows activation (and the PowerShell version)</title>
      <dc:creator>Matthew J. Moore</dc:creator>
      <pubDate>Wed, 04 Nov 2026 16:44:16 +0000</pubDate>
      <link>https://dev.to/krbkeys/the-slmgr-commands-i-actually-use-to-debug-windows-activation-and-the-powershell-version-kp5</link>
      <guid>https://dev.to/krbkeys/the-slmgr-commands-i-actually-use-to-debug-windows-activation-and-the-powershell-version-kp5</guid>
      <description>&lt;p&gt;I spend a weird amount of my week staring at Windows activation errors. I run a small shop that sells Windows and Office keys, so when something won't activate, it lands in my inbox. After a few hundred of these I noticed I always reach for the same handful of commands, so here they are, with what each one actually tells you.&lt;/p&gt;

&lt;p&gt;Everything below needs an elevated prompt. Right click Start, pick Terminal (Admin), and go from there. If you run these as a normal user you'll get "access denied" and think something is broken.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, a small trick: stop the popups
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;slmgr&lt;/code&gt; is just a VBScript (&lt;code&gt;slmgr.vbs&lt;/code&gt;) and by default every command pops up a little message box. That's annoying when you want to copy the output or run a few commands in a row. Run it through &lt;code&gt;cscript&lt;/code&gt; instead and it prints straight to the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cscript //nologo %windir%\system32\slmgr.vbs /dli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same commands, same output, just text you can actually copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slmgr /dli&lt;/code&gt;: what am I looking at?
&lt;/h2&gt;

&lt;p&gt;This is always my first command. It shows the edition, the license channel and the last five characters of the installed key.&lt;/p&gt;

&lt;p&gt;The line that matters most is &lt;strong&gt;Description&lt;/strong&gt;. It tells you the channel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;RETAIL channel&lt;/code&gt;: a key someone bought on its own. Can usually move to a new PC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;OEM_DM channel&lt;/code&gt;: the key that came with the laptop, tied to that hardware.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VOLUME_KMSCLIENT channel&lt;/code&gt;: the machine expects a company KMS server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VOLUME_MAK channel&lt;/code&gt;: a volume key that activates directly with Microsoft.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Half the "mystery" activation errors I see make sense the moment you read this line. If a home PC says &lt;code&gt;VOLUME_KMSCLIENT&lt;/code&gt;, it's going to throw KMS errors like 0x8007232B or 0xC004F074 forever, because there's no company server for it to talk to.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slmgr /dlv&lt;/code&gt;: the verbose version
&lt;/h2&gt;

&lt;p&gt;Same as &lt;code&gt;/dli&lt;/code&gt; plus a lot more: activation ID, installation ID, remaining rearm count, and KMS details if it's a volume machine. I mostly use it when &lt;code&gt;/dli&lt;/code&gt; didn't explain things, or when I need the installation ID for phone activation.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slmgr /xpr&lt;/code&gt;: is it permanent?
&lt;/h2&gt;

&lt;p&gt;One line answer. Either "The machine is permanently activated" or a date when activation runs out. If you see a date about 180 days out, that's a KMS activation, not a permanent one. Super common on used business laptops, and the reason people get the "your Windows license will expire soon" popup months after buying the machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slmgr /ipk &amp;lt;key&amp;gt;&lt;/code&gt; and &lt;code&gt;slmgr /ato&lt;/code&gt;: swap and activate
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/ipk&lt;/code&gt; installs a new product key (replacing the old one). &lt;code&gt;/ato&lt;/code&gt; tells Windows to go activate right now instead of waiting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /ato
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Give it a few seconds between the two. If &lt;code&gt;/ato&lt;/code&gt; fails, the error code it shows is the most useful piece of information you'll get, so write it down before you start googling.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slmgr /upk&lt;/code&gt; and &lt;code&gt;slmgr /cpky&lt;/code&gt;: before you wipe an old PC
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/upk&lt;/code&gt; uninstalls the product key from the current machine. I tell people to run it on their old PC before moving a retail key to a new one, so the old machine isn't still holding it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/cpky&lt;/code&gt; clears the key from the registry so it can't be read back out by tools that dump product keys. Doesn't deactivate anything, just tidies up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The PowerShell way
&lt;/h2&gt;

&lt;p&gt;VBScript is being phased out of Windows, so it's worth knowing the PowerShell equivalent too. The licensing info lives in a CIM class called &lt;code&gt;SoftwareLicensingProduct&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Get-CimInstance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SoftwareLicensingProduct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Filter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PartialProductKey IS NOT NULL"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;Select-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;LicenseStatus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PartialProductKey&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That lists Windows and any Office installs that use the same licensing service. &lt;code&gt;LicenseStatus&lt;/code&gt; is a number:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Unlicensed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Licensed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Initial grace period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Additional grace period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Non-genuine grace period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Notification mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Extended grace period&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you only care about Windows itself, filter on the Windows application ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Get-CimInstance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SoftwareLicensingProduct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Filter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND PartialProductKey IS NOT NULL"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;Select-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;LicenseStatus&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And one more I use a lot: if the machine shipped with Windows, the original OEM key is often stored in the firmware. This reads it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Get-CimInstance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SoftwareLicensingService&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;OA3xOriginalProductKey&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Blank output just means there's no key in the firmware, which is normal on custom builds.&lt;/p&gt;

&lt;h2&gt;
  
  
  My actual order of operations
&lt;/h2&gt;

&lt;p&gt;When someone sends me "Windows won't activate", this is basically it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;/dli&lt;/code&gt; to see the edition and channel. Wrong edition or a volume channel explains most problems straight away.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/xpr&lt;/code&gt; to see if it was ever permanently activated.&lt;/li&gt;
&lt;li&gt;Check the date, time and time zone. A wrong clock breaks the secure connection to the activation servers (hello, 0x80072F8F).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/ipk&lt;/code&gt; with the right key for that edition, then &lt;code&gt;/ato&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;/ato&lt;/code&gt; fails, read the error code and go from there.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most of the time it never gets past step 1 or 2. The error messages Windows shows are pretty bad at explaining themselves, but these commands usually tell you the real story in about ten seconds.&lt;/p&gt;

&lt;p&gt;If you've got a weird activation error you keep running into, drop it in the comments. I've probably seen it, and if I haven't I'd like to.&lt;/p&gt;

</description>
      <category>windows</category>
      <category>powershell</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
