• 获取当前 Windows 的安装序列号


    Dim s
    s = InputBox("当前Windows系统序列号为:", "Windows序列号", GetWindowsSN)
    WScript.Quit
    
    
    '取得当前Windows序列号函数
    
    Function GetWindowsSN()
        Const HKEY_LOCAL_MACHINE = &H80000002
        strKeyPath = "SOFTWAREMicrosoftWindows NTCurrentVersion"
        strValueName = "DigitalProductId"
        strComputer = "."
        Dim iValues()
        Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "
    ootdefault: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
        GetWindowsSN = strProductKey
    End Function

    windows.vbs  通用

  • 相关阅读:
    剑指offer 顺时针打印矩阵
    剑指offer队列中的最大值
    固定顶部指定div不滑动
    调整圆环统计图格式
    补插一个MUI中UI组件示例地址
    统计图左右滑动
    mui集成百度ECharts的统计图表以及清空释放图表
    页面ajax自带的访问后台时,正在加载中
    js弹出div层内容(按回退键关闭div层及遮罩)
    地图经纬度定位不准
  • 原文地址:https://www.cnblogs.com/hookjoy/p/4072344.html
Copyright © 2020-2023  润新知