Bonjour à tous,

petite compréhension à m'apporter ci joint l'affichage de l'execution d'un script vbs sur mon poste en Windows seven x64
donc il s’exécute correctement

Nom : vbs.jpg
Affichages : 407
Taille : 41,4 Ko


par contre sous windows serveur 2008 ou 2012 std , je n'ai pas de fenetre ni une execution correcte du fichier vbs

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
'' Plugin for OCS Inventory NG 2.x
'' MsSecurityCenter 2.0.1 (30/08/2012)
'' Nicolas DEROUET (nicolas.derouet[gmail]com)
On Error Resume Next
 
arrCat = Array("AntiVirus","Firewall","AntiSpyware")
arrNbr = Array(0,0,0)
 
Set objWMIService_AV = GetObject("winmgmts:\\.\root\SecurityCenter")
If Not IsNull (objWMIService_AV) Then
  For a = LBound(arrCat, 1) To UBound(arrCat, 1)
    Set colItems = objWMIService_AV.ExecQuery("Select * from " & arrCat(a) & "Product")
 
    For Each objAVP In colItems
        productEnabled = "0"
        If objAVP.onAccessScanningEnabled Then productEnabled = "1"
 
        productUptoDate = "0"
        If objAVP.productUptoDate Then productUptoDate = "1"
 
        writeXML "1", arrCat(a), objAVP.companyName, objAVP.displayName, objAVP.versionNumber, productEnabled, productUptoDate
        arrNbr(a) = arrNbr(a) + 1
    Next
  Next
End If
Set objWMIService_AV = Nothing
 
Set objWMIService_AV = GetObject("winmgmts:\\.\root\SecurityCenter2")
if Not IsNull (objWMIService_AV) Then
  For a = LBound(arrCat, 1) To UBound(arrCat, 1)
    Set colItems2 = objWMIService_AV.ExecQuery("Select * from " & arrCat(a) & "Product")
 
    For Each objAVP In colItems2
      Set WshShell = WScript.CreateObject("WScript.Shell")
      Set WshProcessEnv = WshShell.Environment("Process")
      exe = objAVP.PathToSignedProductExe
      exe = Replace(exe,"%ProgramFiles%",WshProcessEnv("ProgramFiles"))
      If Mid(exe,1,1) = """" Then
        Max = 2
        While (Mid(exe,Max,1) <> """") And (Max <> Len(exe) )
          Max = Max + 1
        Wend
        exe = Mid(exe,2,Max-2)
      End If
      exe = Replace(exe,"\","\\")
      strCompanyName = ""
      strVersionNumber = ""
      Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
      Set colFiles = objWMIService.ExecQuery ("Select * from CIM_Datafile Where name = '" & exe & "'")
      If colFiles.Count = 0 Then
        exe = Replace (exe," (x86)","")
        Set colFiles = objWMIService.ExecQuery ("Select * from CIM_Datafile Where name = '" & exe & "'")  
      End If
 
      For Each itemFile In colFiles
        strCompanyName = (itemFile.Manufacturer)
        strVersionNumber = (itemFile.Version)
      Next
 
      productEnabled = "0"
      If Mid(dec2bin(objAVP.ProductState),12,1) = "1" Then productEnabled = "1"
 
      productUptoDate = "0"
      If Mid(dec2bin(objAVP.ProductState),16,8) = "00000000" Then productUptoDate = "1"
 
      writeXML "2", arrCat(a), strCompanyName, objAVP.displayName, strVersionNumber, productEnabled, productUptoDate
      arrNbr(a) = arrNbr(a) + 1
    Next
  Next
End If
Set objWMIService_AV = Nothing
 
Sub writeXML(scSCV,scCat,scComp,scProd,scVer,scEna,scDate)
  Wscript.Echo _
  "<SECURITYCENTER>" & vbNewLine & _
  "<SCV>" & scSCV & "</SCV>" & vbNewLine & _
  "<CATEGORY>" & scCat & "</CATEGORY>" & vbNewLine & _
  "<COMPANY>" & scComp & "</COMPANY>" & vbNewLine & _
  "<PRODUCT>" & scProd & "</PRODUCT>" & vbNewLine & _
  "<VERSION>" & scVer & "</VERSION>" & vbNewLine & _
  "<ENABLED>" & scEna & "</ENABLED>" & vbNewLine & _
  "<UPTODATE>" & scDate & "</UPTODATE>" & vbNewLine & _
  "</SECURITYCENTER>"
End Sub
 
Function dec2bin (n)
    b = Trim((n Mod 2))
    n = n \ 2
    Do While n <> 0
        b = Trim((n Mod 2)) & b
        n = n \ 2
    Loop
    While Len(b) < 24
      b = "0" & b
    Wend
    dec2bin = b
End Function
merci d'avance
cordialement