The product key is located in the registry under

HKLM\Software\Microsoft\Windows NT\CurrentVersion

It is the value named: DigitalProductId

If you look at it, you will realize it is encrypted:

That is what his script takes care of. It reverses the simple XOR encryption and turns that numeric mess into a readable product key.

cscript serial.vbs

save the following code to serial.vbs

'*****************************************
'* Script Usage: Get Windows Product Key *
'* http://www.intelliadmin.com *
'* Revision 8/15/2012 *
'***************************************** 'Constants for our registry query
const HKEY_LOCAL_MACHINE = &H80000002
sRegistryKeyName = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
sRegistryValueName = "DigitalProductId" function GetProductKey
'Get the raw product key data
dim pValues()
Set poRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
poRegistry.GetBinaryValue HKEY_LOCAL_MACHINE,sRegistryKeyName,sRegistryValueName,pValues Dim sArrayPID
sArrayPID = Array() 'In that data, positions 52-66 contain our product id info
'We copy to an array so we can decrypt For i = to
'Increase our array size by one
ReDim Preserve sArrayPID( UBound(sArrayPID) + )
'Insert our value into the end if the array
sArrayPID(UBound(sArrayPID)) = pValues(i)
Next 'Consants for our product key
Dim sProductKeyChars
sProductKeyChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","","","","","","","") For i = To Step -
k =
For j = To Step -
k = k * Xor sArrayPID(j)
sArrayPID(j) = Int(k / )
k = k Mod
Next
sProductKey = sProductKeyChars(k) & sProductKey
'Adds the - between the key sections
if i Mod = And i <> Then sProductKey = "-" & sProductKey
Next
GetProductKey = sProductKey
end function function GetOSVersion
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in SystemSet
GetOSVersion = Trim(System.Caption) & " (" & System.Version & ")"
next
end function wscript.echo GetOSVersion & ", " & GetProductKey

reference:

http://www.intelliadmin.com/index.php/2012/08/get-your-windows-product-key-from-a-script/

Get your Windows product key from a script的更多相关文章

  1. Microsoft Office 2013 Product Key

    Microsoft Office 2013 Product Key ( Professional Plus ) PGD67-JN23K-JGVWW-KTHP4-GXR9G B9GN2-DXXQC-9D ...

  2. 如何更换Office 2013的product key?

    第一步 第二步 第三步 ... ... ... ... ^_^   参考资料 ======================== Change Product Key Office 2013 Home ...

  3. Windows Office key 持续更新地址

    微软 Windows  Office 系列序列号,每日都有更新,上面显示的基本都可用,包括MAK及Retail Key. Windows 10   http://textuploader.com/52 ...

  4. 自定义针对Product Key处理的TextBox

    代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst ...

  5. 【jenkins】【java】【tomcat】windows host key verification failed

    适用于windows系统 出现这个问题的原因tomcat启动的用户找不到本地公私钥路径 如果tomcat 启动时候选择 local system account (默认此选项),请把你的公私钥文件(i ...

  6. VS2017 Product Key

    Enterprise: NJVYC-BMHX2-G77MM-4XJMR-6Q8QF Professional: KBJFW-NXHK6-W4WJM-CRMQB-G3CDH

  7. 使用slmgr查看、删除windows 授权(key)

    查看 slmgr.vbs /dlv 删除授权 使用管理员权限进入cmd All program -> accessories -> Command Prompt (右键 已管理员方式运行) ...

  8. vs2019 product key

    Visual Studio 2019 Enterprise BF8Y8-GN2QH-T84XB-QVY3B-RC4DF     Visual Studio 2019 Professional NYWV ...

  9. KMS服务器激活Windows和Office2013EnterprisePlus

    KMS服务器激活Windows和Office2013EnterprisePlus 参考了文档 http://wenku.baidu.com/view/0cb2602358fb770bf68a5501. ...

随机推荐

  1. [转]c#.NET和VB.NET语法的比较

    本文转自:http://www.cnblogs.com/lify0407/archive/2007/08/01/838589.html c#.NET和VB.NET语法的比较   VB.NET C# C ...

  2. 关于Collections中的sort()方法总结

    用Java集合中的Collections.sort方法对list排序的两种方法 本文部分引用自:http://my.oschina.net/leoson/blog/131904 用Collection ...

  3. B/S的验证控件

    验证控件 首先设置一下框架,设置为.net framework 4.0,在4.5下貌似会报错,设置方法为项目上右键/属性页/找到左侧菜单栏里的生成/将框架版本改为4.0. 一.非空验证:Require ...

  4. 类似微博菜单 ,用swift语言编写

    自定义tabar搭载界面1.-自定义标题按钮_如图  2.10-导航条按钮封装 演示如下 源代码下载DSWeibo.zip

  5. ant+dbunit 导xml到mysql

    1.增加自己的data目录和xml数据文件 2.lib依赖 commons-logging-1.1.1.jar dbunit-2.4.8.jar junit-4.9b2.jar mysql-conne ...

  6. SQL SERVER 锁定的实例

    ---实例DB:AdventureWorks2014 --- 创建view DBLocks USE [AdventureWorks2014] GO /****** Object: View [dbo] ...

  7. [转]Windows Shell 编程 第二章 【来源:http://blog.csdn.net/wangqiulin123456/article/details/7987893】

    第二章Shell的结构  “Shell 编程”的大伞之下有大量的API函数和COM接口.这个种类繁多的‘命令’集允许你用不同的方法对Windows Shell进行编程.函数和接口并不是两种提供相同功能 ...

  8. linux启动报错:kernel panic - not attempted to kill init

    系统类型:CentOS 6.4(x64) 启动提示:Kernel panic - not syncing: Attempted to kill init 解决办法: 系统启动的时候,按下‘e’键进入g ...

  9. (四)JAVA使用POI操作excel

    1,字体处理 Demo12.java package com.wishwzp.poi; import java.io.FileOutputStream; import org.apache.poi.h ...

  10. 如何在浏览器网页中实现java小应用程序的功能

    我们知道,java语言的运用就是面向对象实现功能,和c不同,java语言对于程序员来说,运用起来更为简便. 小应用程序与应用程序不同,小应用程序只能在与Java兼容的容器中运行,可以嵌入在HTML网页 ...