Changing the Product Key in Server 2012 using PowerShell

I have come across a useful set of cmd’s for when you need to change the Product Key in server 2012. When I went to active my new file server,  I ran into an issue when trying to activate with the Product  KMS key.

Server 2012’s system properties do not allow you to change the Product key.

To change this you need to open power shell in privileged mode and enter the following cmd’s.
slmgr -upk (this removes the current Product Key)

slmgr -ipk XXXX-XXXX-XXXX-XXXX (this installs the new Product Key)

Please see Microsoft’s Article ID: 2750773:

Happy activating.

42 thoughts on “Changing the Product Key in Server 2012 using PowerShell

Add yours

  1. Oh, thanks, you really saved my day.

    I wonder, why Microsoft put their stupid metro into new 2012 server but didn’t bother to implement a stupid button “Change product key” into their system… My activation kept failing after clean installation.

    1. Good question. Does Microsoft REALLY expect system admins to install touch screens in all their data centers? The Metro theme on Server is flat out annoying.

    2. Yeah, the metro interface is really stupid for server and windows in general. I instead installed “Classic Shell” to get the classic start menu back. Now my server is 100% usable.

  2. I have a licensed copy of Server 2012 and a MAK key; and no “Change product key” option in System settings. Does this “ipk” command option of slmgr (which is specifed for a KMS key) work for a MAK key?

    1. Software Licensing management tool (SLMGR) is used for KMS licensing using scripts or configuring Server core installations.

      The Powershell Command slmgr -ipk installs Product Keys (i)install(PK)product key, if you would like to Uninstall a product use (u) instead of (i) this will work with MAK and KMS product keys.

  3. Just curious, I was trying to remove an enterprise LIC Key and replace it with the developer license key… I can do the slmgr -upk but the slgmr -ipk, failed when I entered the developer key…. Got any suggestions.

    1. Unfortantly this is something i havent come across, have you tryed the below.

      From an elevated command prompt, determine the current edition name with the command DISM /online /Get-CurrentEdition. Make note of the edition ID, an abbreviated form of the edition name. Then run DISM /online /Set-Edition: /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula, providing the edition ID and a retail product key. The server will restart twice.


      List Available Editions

      Use DISM /online /Get-TargetEditions to list available editions for upgrade. To upgrade from evaluation to standard use DISM /online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula. The command promps for reboot; it does not reboot automatically

      Convert Windows Server 2012 Standard Edition to Datacenter Edition

      dism /online /set-edition:ServerDatacenter /ProductKey:48HP8-DN98B-MYWDG-T2DCC-8W83P /AcceptEulay

    Dear Microsoft, why didn’t you add a simple f*cking button in your assf*cking METRO GUI for that feature???
    in other words: Ich kann nicht essen was ich bei M$ Produkten kotzen könnte!

    1. FYI, I did not state that the cmd’s used are Powershell cmdlets, I am referring to the using powershell to run the command prompt commands. Command Prompt is now on its way to becoming depreciated so it makes sense and is best practice to use PowerShell to run commands.

      Best Regards,

      1. My bad then, typically when someone says they have a way to do something using powershell they mean that they’re doing it using a cmdlet or the .Net framework, something native to powershell. You’re taking advantage of how powershell will run cmd.exe transparently to execute legacy commands. Slmgr being a vbscript your post could just have easily been titled, “Use VBScript to Change Product Keys”.

        It’s like saying use powershell to get ip info, open powershell and type ipconfig…

        Best Regards,
        Jason 😉

      2. All Comments of a argumentative nature will be removed, everyone has a right to an option and posts can be interpreted in different ways. Please keep questions focused on the subject matter.

        Best Regards,

  5. Ryan, pointing out the function of the PowerShell console is not being argumentative, I understand it may be sensitive to have your article corrected but it doesn’t change the nature of my comment.

    The subject matter, according to your title, is using PowerShell to change a product key. You’re using a PowerShell console to run a vbscript, as opposed to setting the correct registry key and restarting the appropriate service. I was hoping to avoid digging into slmgr.vbs by selecting an article titled, “Changing the product key Using PowerShell”. Unfortunately, I found this article instead…

    Like I was said in my now deleted comment, if the article title says you’re doing something using PowerShell then people will expect something involving a little more than having PowerShell call cmd.exe.

    I think it’s perfectly appropriate to wrap PowerShell syntax around other command line utilities, Jeffrey Hicks has a series of articles on the subject and I’ve even posted functions in the technet gallery that essentially just run qwinsta and rwinsta to manage rdp sessions.

    What you describe would work If you entered slmgr into the run prompt and cannot be invoked remotely using psremoting. Because my question is still unanswered I’ll be happy to share a link here when I find out how to manage product keys using PowerShell.

    Best Regards,

    1. Dear Jason,

      Thank you for your post,

      No comments have been deleted please see above, comments are to be approved before they are posted on this site. This post is purely for changing the default KMS Key to MAK.

      The article is correct as it stats “using PowerShell” (Application) not PowerShell cmdlets This can be interpreted in different ways and i take on board you views. The article could have been easily called something else but i choose to use the “Changing the Product Key in Server 2012 using PowerShell”.

      I believe you would be looking for something along the lines of the following:

      There is no question for sensitivity, but all questions are to be directed towards the topic in question. Article names can be easily questioned and its the authors right to name their posts.

      This blog expresses my personal opinions as per the disclaimer.

      I hope this provides closure,

      Best Regards,

      1. Ryan,

        Thanks for your help and It was cool of you to allow my comment through. The article you’re linking to there still uses slmgr so it’s not quite what I’m hoping for. Regardless, it was nice of you to post it and I appreciate the help.


  6. Hi Ray, I have applied the Window powershell and it gives out error: 0xC004F069 on the computer running Microsoft Windows non-core edition run ‘slui.exe 0xC004F069 to display the error txt

  7. I believe this specific post , “Changing the Product Key in Server 2012
    using PowerShell | Ryan Mangan’s IT Blog”, very compelling plus the post was in fact a very good read. Thank you,Tyrone

  8. Prior to upgrading to Windows 8.1 from Windows 7, I could license a Windows 7 computer remotely by typing: slmgr.vbs COMPUTERNAME-ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX. from an administrative CMD prompt. Now I get the error below when attempting to do so. You would think MS would have assumed backwards compatibility would have been required…

    Windows Script Host
    The remote machine does not support this version of SLMgr.vbs

  9. Nice! Ran into this today and this helped me avoid reinstalling from a different ISO hah. Thanks again!

  10. This may be of interest to some also. I came across this and it works fine for me. I the power shell window type — slui 3
    A window will come up for you to type the product key and activate.

  11. this actually worked for me and now my operating system is activated. I don’t know how i forgot all about the slmgr upk and ipk simple command on powershell. Thank for the info.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑

%d bloggers like this: