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. Java基础知识强化之IO流笔记68:Properties和IO流集合使用

    1. Properties和IO流集合使用 这里的集合必须是Properties集合:  public void load(Reader reader):把文件中的数据读取到集合中  public v ...

  2. TCP/IP协议原理与应用笔记04:子网掩码

    1. 子网掩码 是IP 参照物:分网段用的! 比如 192.168.0.1 和192.168.0.2(1).子网掩码为 255.255.255.0那么192.168.0.X 在同一个网段,能互相访问. ...

  3. php中的匿名函数(Anonymous functions)和闭包函数(closures)

    一:匿名函数 (在php5.3.0 或以上才能使用) php中的匿名函数(Anonymous functions), 也叫闭包函数(closures), 允许指定一个没有名称的函数.最常用的就是回调函 ...

  4. wsdl 关于nillable和minOccurs 在.NET和java中的不同

    术语约定文章中会反复出现[值类型].[包装类型].[普通引用类型].[元素节点]和[元素取值]的表述1> [值类型]指的是java和.NET中的基本数据类型,如:int:2> [包装类型] ...

  5. spring的依赖注入的最常见的两种方法

    package com.lsz.spring.action; public class User { /** * set注入 */ private String username; public vo ...

  6. 用EnumDisplaySettings获取显示设置信息

    LPDEVMODE pMode = new DEVMODE;//开空间 DWORD dwBitsPerPel=0;//每象素所使用的显存位数(Bits) DWORD dwPelsWidth=0;//水 ...

  7. Android IntentService使用

    因为多数启动服务不必同时处理多个请求(在多线程情景下会很危险),所以使用IntentService类实现服务是很好的选择.本经验将通过继承IntentService输出当前时间教大家如何使用Inten ...

  8. ThreadLocal 设计模式浅谈

    部分代码:ThreadLocal中 的get方法, 获得的是当前线程相关的对象 /** * Returns the value in the current thread's copy of this ...

  9. oc 一些通用函数

    1 i= 0,1,2... unichar c = [self characterAtIndex:i]; //取出i这个位置对应的字符 2 拼凑字符串 [NSString stringWithForm ...

  10. Objective-C 学习笔记(Day 3,下)

    ------------------------------------------- 封装概念及其原理 一个Gun类的例子来详细说明这一环节: #import <Foundation/Foun ...