How to farm the Win10 key from a Win7 Upgrade in VirtualBox

Scenario. You have a Windows 7 key and want to farm a Windows 10 key from it, using the automatic upgrade. Of course, you want to do this in a VirtualBox[1]. The first thing you do is, set up a VM with at least 30GB of harddrive. Let's assume that this VM is called Nekarat. This is an outdated pop culture reference, google it.

In the host system (not the VM), go to your happy place (i.e. cmd.exe) and do this:

cd c:\Program Files\Oracle\VirtualBox
VBoxManage.exe setextradata Nekarat VBoxInternal/CPUM/CMPXCHG16B 1

It will not seem like anything has happened, but trust me, it did. It enables a certain CPU instruction for the virtual machine without whome the Windows 10 update fails.

Boot the VM. Install Windows and update it completely. Do not install the VirtualBox Guest additions: The display driver is incompatible with the Windows 10 update. Now might be a good time to make a snapshot if you want to upgrade more than one key. Activate Windows. Then, in the VM, add this to the registry, courtesy of filecritic.com:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade]
"AllowOSUpgrade"=dword:00000001

Check for updates, it should now download Windows 10. After that part is done, create a file called key.vbs and put this inside:

Option Explicit

Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
ProductID   = "Product ID:   " & objshell.RegRead(Path & "ProductID")
ProductKey  = "Product Key:  " & ConvertToKey(DigitalID)
ProductData = ProductName  & vbNewLine & ProductID  & vbNewLine & ProductKey
WScript.echo ProductData  

Function ConvertToKey(Key)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    'Check if OS is Windows 8
   isWin8 = (Key(66) \ 6) And 1
    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
    i = 24
    Maps = "BCDFGHJKMPQRTVWXY2346789"
    Do
        Current= 0
        j = 14
        Do
           Current = Current* 256
           Current = Key(j + KeyOffset) + Current
           Key(j + KeyOffset) = (Current \ 24)
           Current=Current Mod 24
            j = j -1
        Loop While j >= 0
        i = i -1
        KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
        Last = Current
    Loop While i >= 0
    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput
    ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5)  & _
      "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & _
      Mid(KeyOutput, 21, 5)
End Function

And from your commandline in the VM, run the command cscript key.vbs. There you go, key farmed.

  1. Side note. If you have a customized Windows, you possibly need to install Virtual Box 4.3.12 because anything after that will throw an error. []

2 responses to “How to farm the Win10 key from a Win7 Upgrade in VirtualBox”

  1. +++ath0 says:

    ecx, msg db 'vpn mmmm...; yes! This is only a little bump from an old, old friend. Question! Is 1+1 still 3? ;) Greetings from the north. Send my love to Mr. math; He*** (disambiguation)',0xa;int 0x80

  2. rattle says:

    Consulting the logfiles, I conclude that there's not that many people I know from that specific spot in the north. Also, there's a certain characteristic chime to your ranting. If you are who I think you are, drop me a proper eMail and get in touch, old man.

Leave a Reply

Your email address will not be published. Required fields are marked *