onycro

Find Windows 10 and Windows 8 Product Key Script

Jul 30th, 2015
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Save this text as a vbs file and execute it then (double click)
  2. Set WshShell = CreateObject("WScript.Shell")
  3. MsgBox "Windows CD Key: "+ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
  4.  
  5. Function ConvertToKey(Key)
  6. Const KeyOffset = 52
  7. i = 28
  8. Chars = "BCDFGHJKMPQRTVWXY2346789"
  9. Do
  10. Cur = 0
  11. x = 14
  12. Do
  13. Cur = Cur * 256
  14. Cur = Key(x + KeyOffset) + Cur
  15. Key(x + KeyOffset) = (Cur \ 24) And 255
  16. Cur = Cur Mod 24
  17. x = x -1
  18. Loop While x >= 0
  19. i = i -1
  20. KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
  21. If (((29 - i) Mod 6) = 0) And (i <> -1) Then
  22. i = i -1
  23. KeyOutput = "-" & KeyOutput
  24. End If
  25. Loop While i >= 0
  26. ConvertToKey = KeyOutput
  27. End Function
Advertisement
Add Comment
Please, Sign In to add comment