IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Execution VBS sur Serveur 2008 ou 2012


Sujet :

VBScript

  1. #1
    Membre à l'essai
    Homme Profil pro
    Informatique Industriel Automaticien
    Inscrit en
    Février 2014
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Informatique Industriel Automaticien
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2014
    Messages : 15
    Points : 12
    Points
    12
    Par défaut Execution VBS sur Serveur 2008 ou 2012
    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 : 338
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

  2. #2
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 296
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 296
    Points : 3 549
    Points
    3 549
    Par défaut
    bonjour,

    dans un 1er temps retirer la ligne 5 "On Error Resume Next"
    pour pouvoir identifier l'erreur
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

Discussions similaires

  1. Réponses: 3
    Dernier message: 03/07/2013, 16h31
  2. Executer programme sur serveur distant en FTP
    Par blepharocyte dans le forum Windows 7
    Réponses: 3
    Dernier message: 08/02/2011, 22h04
  3. [SQL 2005 sur Serveur 2008] pb de procedure stockée dans master
    Par A.S.I Gérard dans le forum Développement
    Réponses: 2
    Dernier message: 25/06/2009, 10h07
  4. Lecteur DAT sur Serveur 2008
    Par SINASOFT dans le forum Windows Serveur
    Réponses: 3
    Dernier message: 30/07/2008, 01h25
  5. [Système] Pb execution script sur serveur
    Par Cedwik dans le forum Langage
    Réponses: 5
    Dernier message: 08/09/2006, 11h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo