Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Success Exit Code From SLMGR Command?

What exit code applies to Microsoft's licensing VBS applet SLMGR?

I am trying to use

slmgr -ipk 67YRR-JYR7R-H7RJR-RGRV2-R7RWR
slmgr -ato

(not the real code)

in a COMMAND step.  The step is succeeding (I can see the target machine has the new key and it is activated) but PDQ sits on that command endlessly. 

I THINK the issue is that it does not see a success code from that command so it just keeps running.  I have a 0 in the SUCCESS CODE field but that is apparently not doing it.

If I can't figure this out I will just set PDQ to time out after 3 minutes (usually takes 30 seconds), but that is not a pretty work around.

Your thoughts would be greatly appreciated.



Date Votes
  • That's because slmgr pops up a window when it's done. Try this:

    cscript //B "%windir%\system32\slmgr.vbs" /ipk 67YRR-JYR7R-H7RJR-RGRV2-R7RWR
  • Thanks for the quick response.  I just tried your suggestion and while it now completes without error in PDQ, it does not change the product key. 

    The original script does change the product key and activate it which are two separate commands so it should not be hung up on a popup... unless the Activate command is (ATO) is causing it.  I will test and get back to you very shortly.

  • Nope, I tried it with:

    slmgr -ipk 67YRR-JYR7R-H7RJR-RGRV2-R7RWR
    cscript //B "%windir%\system32\slmgr.vbs" -ato

    and it still hangs in PDQ... but it did change the key!


  • Can you try below 2 batch scripts as install step with PDQ.
  • Hi All, I am having a hard time with this also.  I actually don't even care if it gives me a return code or ever exits the 'running' phase lol, but I can't seem to get it to do what I want.

    I have a bunch of Windows 10 Pro computers licensed via GVLK and I'm just trying to give them an Enterprise key to convert them from pro to ent.   It seems like I should be able to do it with a basic


    slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX (a win10 Ent MAK key)

    but it never seems to convert it

  • Correct me if I'm wrong here folks, but don't changes to EDITIONS of windows have to be done through DISM? I know I've done it in the past converting server 2008 boxes from standard to datacenter, and I had to use DISM to accomplish that.


    Dism /online /Set-Edition:Enterprise /AcceptEula /ProductKey:12345-67890-12345-67890-12345

  • In my case I needed to run slmgr with the /skms parameter to point clients to a different KMS server.
    I created two steps, leaving success code at 0. 

    This worked for me:

    Step 1       cscript.exe "%Systemroot%\system32\slmgr.vbs" /skms <IP Address of KMS Server>:1688
    Step 2       cscript.exe "%Systemroot%\system32\slmgr.vbs" /ato