Tag Archives: key

HDD to SSD for OS and Windows 7 Key Recovery VB Script


I recently purchased a 250GB Solid State Drive made by Crucial to replace my 150GB VelociRaptor Hard Disk Drive for my Operating System.   There are two routes I could think of to go about installing the OS on the SSD.

  1. Copy image from HDD to SSD
    • Pros:  Would allow a fairly seamless transition from one drive to another.  No need to migrate files to a third disk and then reload to the new SSD.
    • Cons: Any inefficiencies/growth Windows has created (software bloat), or any disorganization I have created will be carried over to the new SSD. Any corrupted files or disk sectors would be carried over to the new drive.
  2. Install fresh copy of OS on SSD
    • Pros: A fresh OS always runs better because it has not had time to bloat.
    • Cons: Time; I will have to migrated any files I want to keep to another drive, install Windows, install any applications/drivers I had previously, then migrate files back to main drive.

I decided to go with option 2; installing a fresh copy of Windows 7 to the new SSD.  One of the cons of doing this is having to move the files you want to keep to another drive and then back to the main OS.  This does not impact me because I already back up to google drive, a cloud service, and I also have a secondary 1TB disk drive where I save almost all files.  Also, my current installation of Windows 7 has bloated quite a bit.  I have done some work to remove the bloat but I like the idea of starting over with a new copy of windows.

Since I am reinstalling windows I will need the windows license key.  Microsoft likes to make it difficult to find your license key.  It is not located in any convenient place unless you have the original packaging or purchased a computer with the OS already installed and the sticker is still on the computer case which would contain the windows key.  They probably claim to make it hard to find so that the key can not be easily stolen.  However, if this were truly the case the key would not be placed on a sticker on the outside of many store bought cases.  I personally believe they make it difficult to find the key so that it is hard to keep track of and then many users will just buy a new copy or if they are buying a new computer opt with bundling the OS with the new computer.

One way to find your windows license key is to use a VB script to read it from your registry and then decode it.

Below is the script I used which I obtained from howtogeek.com.
Direct link to article: http://www.howtogeek.com/206329/how-to-find-your-lost-windows-or-office-product-keys/
This article has much more information on this process, and also other processes for recovering your windows key such as third party software.

Paste the code into a text document, save the file with a “.vbs” file extension, close, and then double click the new file to run it.  It should present you with a popup window that contains your windows key.

Set WshShell = CreateObject(“WScript.Shell”)
MsgBox ConvertToKey(WshShell.RegRead(“HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId”))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Cur = 0
x = 14
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 – i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = “-” & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function