Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_log_av.bat.kix

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

  1. ; Get the current date in YYYYMMDD format
  2. $Today = "@YEAR" + Right( "0@MONTHNO", 2 ) + Right( "0@MDAYNO", 2 )
  3. ; Create the directory if it doesn't exist
  4. If Exist( "\\Server\Logs\$Today\*.*" ) = 0
  5. 	MD "\\Server\Logs\$Today"
  6. EndIf
  7.  
  8. ; Read the AV software status
  9. $objWMISvc = GetObject( "winmgmts:{impersonationLevel=impersonate}!//./root/SecurityCenter" )
  10. $colItems  = $objWMISvc.ExecQuery( "SELECT * FROM AntiVirusProduct", "WQL", 48 )
  11. For Each $objItem In $colItems
  12. 	$Msg = $objItem.displayName + "," + $objItem.versionNumber
  13. 	If $objItem.onAccessScanningEnabled = 0
  14. 		$Msg = $Msg + ",FALSE,"
  15. 	Else
  16. 		$Msg = $Msg + ",TRUE,"
  17. 	EndIf
  18. 	If $objItem.productUptoDate = 0
  19. 		$Msg = $Msg + "FALSE@CRLF"
  20. 	Else
  21. 		$Msg = $Msg + "TRUE@CRLF"
  22. 	EndIf
  23. Next
  24. ; Log the result
  25. If RedirectOutput( "\\Server\Logs\$Today\@USERID.log" ) = 0
  26. 	$Msg
  27. 	$RC = RedirectOutput( "" )
  28. EndIf

page last modified: 2022-10-20