标签:ati man unknown class console software cccccc round rem
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
标签:ati man unknown class console software cccccc round rem
原文地址:http://www.cnblogs.com/czytcn/p/7645597.html