J'aurai besoin d'une petite aide j'ai un script qui me permet de savoir si j'ai un antivirus activé sur l'ordi et son nom
Voici mon code
Code : Tout sélectionner
Local $avname
Global $state
If @OSVersion = "WIN_XP" Then
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter")
$colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct")
For $objAntiVirusProduct In $colItems
$state = $objAntiVirusProduct.onAccessScanningEnabled
Next
if $state = True Then
MsgBox(0,"Info","AV activé")
Else
MsgBox(0,"Info","AV désactivé")
EndIf
Else
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2")
$colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct")
For $objAntiVirusProduct In $colItems
$state = $objAntiVirusProduct.productstate
Next
Dim $AvStatus = Hex($state)
If StringMid($AvStatus, 5, 2) = "10" Or StringMid($AvStatus, 5, 2) = "11" Then
MsgBox(0, "Info", "AV activé")
ElseIf StringMid($AvStatus, 5, 2) = "00" Or StringMid($AvStatus, 5, 2) = "01" Then
MsgBox(0, "Info", "AV désactivé")
EndIf
EndIf
For $objAntiVirusProduct In $colItems
$avname = $objAntiVirusProduct.displayName
Next
If $avname = False Then
MsgBox(0,"","Pas d'antivirus installé")
Else
MsgBox(0,"",$avname)
EndIf
1) comment savoir s'il est a jour ou pas ?
2 ) faire le meme processus pour l'antispyware et le pare feu ... (si possible)
Si ça peut vous aider j'ai le script en vbs mais que pour les versions après Windows XP
Code : Tout sélectionner
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("Report.txt", ForAppending, True)
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\SecurityCenter2")
For Each obj in oWMI.ExecQuery("Select * from AntiVirusProduct")
If InStr(2, Hex(obj.productState), "1", 0) = 2 Then enabled = " [Enabled" Else enabled = " [Disabled"
If InStr(4, Hex(obj.productState), "0", 0) = 4 Then updated = "|Updated] " Else updated = "|Outdated] "
objLogFile.Write("AntiVirus: " _
& obj.displayName _
& Enabled _
& Updated _
& vbCrLf )
Next
For Each obj in oWMI.ExecQuery("Select * from AntiSpywareProduct")
If InStr(2, Hex(obj.productState), "1", 1) = 2 Then enabled = " [Enabled" Else enabled = " [Disabled"
If InStr(4, Hex(obj.productState), "0", 1) = 4 Then updated = "|Updated] " Else updated = "|Outdated] "
objLogFile.Write("AntiSpyware: " _
& obj.displayName _
& Enabled _
& Updated _
& vbCrLf )
Next
For Each obj in oWMI.ExecQuery("Select * from FirewallProduct")
If InStr(2, Hex(obj.productState), "1", 1) = 2 Then enabled = " [Enabled] " Else enabled = " [Disabled] "
objLogFile.Write("Firewall: " _
& obj.displayName _
& Enabled _
& vbCrLf )
Next



