Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_log_av.bat.vbs

(view source code of login_log_av.bat.vbs as plain text)

  1. ' Query the AV status
  2. Set objWMISvc = GetObject( "winmgmts:{impersonationLevel=impersonate}!//./root/SecurityCenter" )
  3. Set colItems  = objWMISvc.ExecQuery( "SELECT * FROM AntiVirusProduct" )
  4. For Each objItem in colItems
  5. 	With objItem
  6. 		strMsg = .displayName & "," & .versionNumber
  7. 		If .onAccessScanningEnabled Then
  8. 			strMsg = strMsg & ",TRUE,"
  9. 		Else
  10. 			strMsg = strMsg & ",FALSE,"
  11. 		End If
  12. 		If .productUptoDate Then
  13. 			strMsg = strMsg & "TRUE"
  14. 		Else
  15. 			strMsg = strMsg & "FALSE"
  16. 		End If
  17. 	End With
  18. Next
  19. Set colItems  = Nothing
  20. Set objWMISvc = Nothing
  21. ' Log the result; variable 'strLog' and constant 'ForAppending' need to be set before
  22. Set objFSO = CreateObject( "Scripting.FileSystemObject" )
  23. Set objLog = objFSO.OpenTextFile( strLog, ForAppending, True, TristateFalse )
  24. objLog.WriteLine strMsg
  25. objLog.Close
  26. Set objLog = Nothing
  27. Set objFSO = Nothing

page last modified: 2024-04-16; loaded in 0.0199 seconds