AU3获取系统激活信息
Posted 虫子樱桃の博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AU3获取系统激活信息相关的知识,希望对你有一定的参考价值。
If IsActivated() = False Then ;InstallProductKey($OSkey) ; installs a product key and also activates it Else MsgBox(0,‘‘,‘ssssss os‘) EndIf If OfficeIsActivated() = False Then ;InstallOfficeProductKey($officekey) ; installs a product key and also activates it Else MsgBox(0,‘‘,‘ssssss offf‘) EndIf Func IsActivated() $oWMIService = ObjGet("winmgmts:\\.\root\cimv2") If IsObj($oWMIService) Then $oCollection = $oWMIService.ExecQuery("SELECT Description, LicenseStatus, GracePeriodRemaining FROM SoftwareLicensingProduct WHERE PartialProductKey <> null") If IsObj($oCollection) Then For $oItem In $oCollection Switch $oItem.LicenseStatus Case 0 ConsoleWrite("Unlicensed" & @CRLF) Return False Case 1 If $oItem.GracePeriodRemaining Then If StringInStr($oItem.Description, "TIMEBASED_") Then ConsoleWrite("Timebased activation will expire in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Else ConsoleWrite("Volume activation will expire in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False EndIf Else ConsoleWrite("The machine is permanently activated." & @CRLF) Return True EndIf Case 2 ConsoleWrite("Initial grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 3 ConsoleWrite("Additional grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 4 ConsoleWrite("Non-genuine grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 5 ConsoleWrite("Windows is in Notification mode" & @CRLF) Return False Case 6 ConsoleWrite("Extended grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False EndSwitch Next EndIf EndIf EndFunc Func OfficeIsActivated() $oWMIService = ObjGet("winmgmts:\\.\root\cimv2") If IsObj($oWMIService) Then $oCollection = $oWMIService.ExecQuery("SELECT Description, LicenseStatus, GracePeriodRemaining FROM OfficeSoftwareProtectionProduct WHERE PartialProductKey <> null") If IsObj($oCollection) Then For $oItem In $oCollection Switch $oItem.LicenseStatus Case 0 ConsoleWrite(" ---UNLICENSED--- " & @CRLF) Return False Case 1 ConsoleWrite(" ---LICENSED--- " & @CRLF) ;If licSr = 0 Then ; WScript.Echo MSG_ERRCODE & licSr & " as licensed" ;End If Return True Case 2 ConsoleWrite("---OOB_GRACE--- Initial grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 3 ConsoleWrite("---OOT_GRACE--- Initial grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 4 ConsoleWrite("---NON_GENUINE_GRACE--- Grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 5 ConsoleWrite("---NOTIFICATIONS--- Grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case 6 ConsoleWrite("---EXTENDED GRACE--- Extended grace period ends in " & $oItem.GracePeriodRemaining & " minutes" & @CRLF) Return False Case Else ConsoleWrite("---UNKNOWN---" & @CRLF) Return False EndSwitch Next EndIf EndIf EndFunc
以上是关于AU3获取系统激活信息的主要内容,如果未能解决你的问题,请参考以下文章