dcoggie Posted January 16, 2017 Share Posted January 16, 2017 This is an extract from a larger program. Avast is enabled and up to date. However on a Vista system it failed to access the info. The printout was - "Avast's ProductState is indeterminate" Why? Local $aResult0, $aResult1, $ProductIsInOrOutOfDate, $ProductDisabledOrNot $oWMI = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\localhost\root\SecurityCenter2") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct") For $objAntiVirusProduct In $colItems $aResult0 = $objAntiVirusProduct.DisplayName $aResult1 = $objAntiVirusProduct.ProductState $ProductIsInOrOutOfDate = StringMid(Hex($aResult1), 7, 2) $ProductDisabledOrNot = StringMid(Hex($aResult1), 5, 2) If @error Then FileWrite($hLogFile, "Warning! *No Antivirus Installed*" & @CRLF) Else Switch $ProductDisabledOrNot Case "10", "11" FileWrite($hLogFile, $aResult0 & " " & "(Enabled - " & (($ProductIsInOrOutOfDate = "10") ? "Not " : "") & "Up to Date)" & @CRLF) Case "00", "01" FileWrite($hLogFile, $aResult0 & " " & "(Disabled - " & (($ProductIsInOrOutOfDate = "10") ? "Not " : "") & "Up to Date)" & @CRLF) Case Else FileWrite($hLogFile, $aResult0 & "'s ProductState is indeterminate" & @CRLF) EndSwitch EndIf Next Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 Usually because there is an issue with WMI and it requires repairing. Link to comment Share on other sites More sharing options...
dcoggie Posted January 17, 2017 Author Share Posted January 17, 2017 19 hours ago, Subz said: Usually because there is an issue with WMI and it requires repairing. I don't think so because FRST produced the correct output. Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 Can you add COM Error Handling: Example from Water: ; COM Error Handler example ; ------------------------- $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler ; ... Your code goes here Exit ; This is my custom defined error handler Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Endfunc Link to comment Share on other sites More sharing options...
dcoggie Posted January 18, 2017 Author Share Posted January 18, 2017 Thanks I'll give that a try. Link to comment Share on other sites More sharing options...
CrumpledBall Posted January 25, 2017 Share Posted January 25, 2017 I have a Mac, and here is my recipe: Avast + this program http://macsecurity.net/view/107/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now