VBScript to return Windows Product Key -
i need vbscript return windows product key. found vbscripts online these specific windows versions. there vbscript available work on windows 7 - windows 8.1?
you can try this code:
const hkey_local_machine = &h80000002 strkeypath = "software\microsoft\windows nt\currentversion" strvaluename = "digitalproductid" strcomputer = "." dim ivalues() set oreg = getobject("winmgmts:{impersonationlevel=impersonate}!\\" & _ strcomputer & "\root\default:stdregprov") oreg.getbinaryvalue hkey_local_machine,strkeypath,strvaluename,ivalues dim arrdpid arrdpid = array() = 52 66 redim preserve arrdpid( ubound(arrdpid) + 1 ) arrdpid( ubound(arrdpid) ) = ivalues(i) next ' <--- create array hold valid characters microsoft product key ---> dim arrchars arrchars = array("b","c","d","f","g","h","j","k","m","p","q","r","t","v","w","x","y","2","3","4","6","7","8","9") ' <--- clever bit !!! (decrypt base24 encoded binary data) ---> = 24 0 step -1 k = 0 j = 14 0 step -1 k = k * 256 xor arrdpid(j) arrdpid(j) = int(k / 24) k = k mod 24 next strproductkey = arrchars(k) & strproductkey ' <--- add "-" between groups of 5 char ---> if mod 5 = 0 , <> 0 strproductkey = "-" & strproductkey next strfinalkey = strproductkey ' <--- part of script displays operating system information , license key ---> strcomputer = "." set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set coloperatingsystems = objwmiservice.execquery _ ("select * win32_operatingsystem") each objoperatingsystem in coloperatingsystems stros = objoperatingsystem.caption strbuild = objoperatingsystem.buildnumber strserial = objoperatingsystem.serialnumber strregistered = objoperatingsystem.registereduser next set wshshell=createobject("wscript.shell") strpopupmsg = stros & vbnewline & vbnewline strpopupmsg = strpopupmsg & "build number: " & strbuild & vbnewline strpopupmsg = strpopupmsg & "pid: " & strserial & vbnewline & vbnewline strpopupmsg = strpopupmsg & "registered to: " & strregistered & vbnewline & vbnewline & vbnewline strpopupmsg = strpopupmsg & "your windows product key is:" & vbnewline & vbnewline & strfinalkey strpopuptitle = "microsoft windows license information" wshshell.popup strpopupmsg,,strpopuptitle,vbcancelonly+vbinformation
Comments
Post a Comment