Get preinstalled product key - Microsoft Community
- Get link
- Other Apps
open notepad > copy , paste below command > save "notepad.vbs"
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 file
if vbyes = msgbox(productdata & vblf & vblf & "save file?", vbyesno + vbquestion, "backup windows key information") then
save productdata
end if
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 file
if vbyes = msgbox(productdata & vblf & vblf & "save file?", vbyesno + vbquestion, "backup windows key information") then
save productdata
end if
'convert binary chars
function converttokey(key)
const keyoffset = 52
dim iswin8, maps, i, j, current, keyoutput, last, keypart1, insert
'check if os windows 8
iswin8 = (key(66) \ 6) , 1
key(66) = (key(66) , &hf7) or ((iswin8 , 2) * 4)
= 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
= -1
keyoutput = mid(maps,current+ 1, 1) & keyoutput
last = current
loop while >= 0
keypart1 = mid(keyoutput, 2, last)
insert = "n"
keyoutput = replace(keyoutput, keypart1, keypart1 & insert, 2, 1, 0)
if last = 0 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
'save data file
function save(data)
dim fso, fname, txt,objshell,username
set objshell = createobject("wscript.shell")
'get current user name
username = objshell.expandenvironmentstrings("%username%")
'create 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
function converttokey(key)
const keyoffset = 52
dim iswin8, maps, i, j, current, keyoutput, last, keypart1, insert
'check if os windows 8
iswin8 = (key(66) \ 6) , 1
key(66) = (key(66) , &hf7) or ((iswin8 , 2) * 4)
= 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
= -1
keyoutput = mid(maps,current+ 1, 1) & keyoutput
last = current
loop while >= 0
keypart1 = mid(keyoutput, 2, last)
insert = "n"
keyoutput = replace(keyoutput, keypart1, keypart1 & insert, 2, 1, 0)
if last = 0 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
'save data file
function save(data)
dim fso, fname, txt,objshell,username
set objshell = createobject("wscript.shell")
'get current user name
username = objshell.expandenvironmentstrings("%username%")
'create 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
Windows / Other/Unknown / Install, upgrade, & activate
- Get link
- Other Apps
Comments
Post a Comment