Batu69 Posted August 11, 2016 Share Posted August 11, 2016 If you've purchased a new PC with Windows pre-installed in the past few years, chances are it has a product key embedded in its BIOS. With a little PowerShell wizardry, you can find that well-hidden key and learn more about your current licensing status. If you've purchased a new PC with Windows pre-installed in the past few years, you might have noticed a few changes on the outside of the device. The biggest change is the absence of a product key, which was included on the holographic Certificate of Authenticity (COA) sticker with PCs that came pre-installed with Windows 7 or earlier versions. Beginning with Windows 8, that information is no longer on a COA but is instead embedded in the BIOS. If you re-install the same version of Windows that came with your PC, it should activate automatically. If you want to record that product key so that you can restore Windows later, it's easy enough to do. Open a PowerShell window and issue this command: (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey If you see no output, that means your system does not include the Windows key in the BIOS, as is often the case with home-built PCs, devices built by a System Builder OEM, or those that were originally sold with a Windows 10 license. Network administrators who manage licensing using Key Management Services can get details about PCs on the network using a different set of options for the same PowerShell command. To view all details about a machine's current licensing status, use this command: Get-WMIObject -Class SoftwareLicensingService | Select-Object -Property * (Be sure to include the asterisk at the end of that command.) To save the key, click in the PowerShell window, drag the mouse pointer across the entire 25-character key, and then right-click. Although nothing appears to happen, your selection has actually been copied to the Clipboard. Paste it into a text file and save it in a safe place. Article source Link to comment Share on other sites More sharing options...
davmil Posted August 11, 2016 Share Posted August 11, 2016 It ran but didn't display the key (blank) . Try this script (copy text below and save as productkey.vbs). coding credits to winaero.com Option Explicit Dim objshell,path,DigitalID, Result Set objshell = CreateObject("WScript.Shell") 'Set registry key path Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" 'Registry key value DigitalID = objshell.RegRead(Path & "DigitalProductId") Dim ProductName,ProductID,ProductKey,ProductData 'Get ProductName, ProductID, ProductKey ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName") ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID") ProductKey = "Installed Key: " & ConvertToKey(DigitalID) ProductData = ProductName & vbNewLine & ProductID & vbNewLine & ProductKey 'Show messbox if save to a file If vbYes = MsgBox(ProductData & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then Save ProductData End If 'Convert binary to chars 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 If (isWin8 = 1) Then keypart1 = Mid(KeyOutput, 2, Last) insert = "N" KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) If Last = 0 Then KeyOutput = insert & KeyOutput End If ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5) End Function 'Save data to a file Function Save(Data) Dim fso, fName, txt,objshell,UserName Set objshell = CreateObject("wscript.shell") 'Get current user name UserName = objshell.ExpandEnvironmentStrings("%UserName%") 'Create a text file on desktop fName = "C:\Users\" & UserName & "\Desktop\WindowsKeyInfo.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set txt = fso.CreateTextFile(fName) txt.Writeline Data txt.Close End Function Link to comment Share on other sites More sharing options...
BimBamSmash Posted August 12, 2016 Share Posted August 12, 2016 These are crazy! I don't have a box that came pre-installed with Windows to try out the first one. But I just tried the second one and whoa...! If this whole mess is by design then, Dear Redmond, thank you kindly for helping out pirates in the field! I'd love to see what results these scripts are going to generate on Windows 10 Home/Pro boxes that have gone through in-place upgrades from Windows 7/8.1 and activated using digital entitlement. I have always wondered if some sort of new product key is generated during that process, even with MS's claim that the new license is something they tie to the serial number of your motherboard in their activation databases, or whatever the details were. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.