gpt4 book ai didi

VBScript 返回 Windows 产品 key

转载 作者:行者123 更新时间:2023-12-02 22:05:29 25 4
gpt4 key购买 nike

我需要 VBScript 来返回 Windows 产品 key 。我在网上找到了一些 VBScript,但这些是特定于某些 Windows 版本的。是否有可在 Windows 7 - Windows 8.1 上运行的 VBScript?

最佳答案

您可以尝试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()
For i = 52 to 66
ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
arrDPID( UBound(arrDPID) ) = iValues(i)
Next
' <--- Create an array to hold the valid characters for a 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")

' <--- The clever bit !!! (Decrypt the base24 encoded binary data) --->
For i = 24 To 0 Step -1
k = 0
For j = 14 To 0 Step -1
k = k * 256 Xor arrDPID(j)
arrDPID(j) = Int(k / 24)
k = k Mod 24
Next
strProductKey = arrChars(k) & strProductKey
' <--- add the "-" between the groups of 5 Char --->
If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
Next
strFinalKey = strProductKey

' <--- This part of the script displays operating system Information and the license Key --->
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For 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

关于VBScript 返回 Windows 产品 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30255656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com