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

Scripts/Batch Discussion :

Script installation + rapport txt


Sujet :

Scripts/Batch

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut Script installation + rapport txt
    Bonjour à tous,


    je cherche à créer un script me permettant de procéder à l'installation de plusieurs logiciels en mode silencieux et sans reboot.
    (Logiciels+Maj OS)
    Après l'exécution de ce script je voudrais qu'il puisse me créer un rapport texte afin d'avoir le résultat sur ce qui a pu être installer ou non.

    Merci à tous

  2. #2
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Avez-vous commencer à écrire ce script ? en Batch ou bien en Vbscript ? et quelles sont les logiciels à installer ?

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par hackoofr Voir le message

    Avez-vous commencer à écrire ce script ? en Batch ou bien en Vbscript ? et quelles sont les logiciels à installer ?
    Alors non, je n'ai commencé à l'écrire.

    Pour les logiciels, il s'agit de teamviewer, adobe reader, le netframework 4, Internet explorer.
    Des logiciels de ce type.

    En bat


  4. #4
    Membre expert
    Avatar de sachadee
    Homme Profil pro
    AMI DU BAT
    Inscrit en
    Janvier 2013
    Messages
    1 478
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Brésil

    Informations professionnelles :
    Activité : AMI DU BAT
    Secteur : Distribution

    Informations forums :
    Inscription : Janvier 2013
    Messages : 1 478
    Points : 3 768
    Points
    3 768
    Par défaut
    Salut,

    Il faut que tu contrôle si il existe des version installable [.MSI] des programmes que tu veux installer.
    Si c'est le cas que tu pourras executer facilement l'installation en mode silencieuce grâce au switch [/S], dans un fichier [.BAT].

    ________________________________
    Un p'tit coup de pouce ça fait toujours plaisir, pensez-y !
    ________________________________

  5. #5
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Comme il a mentionné Sachadee plus haut, le problème est que ça dépend de l'installateur (le programme qui affiche les boutons), il n'y a pas de méthode générique, car l'installateur n'est qu'un programme.
    avec les .msi (= Microsoft System Installer) , tu peux tenter d'utiliser msiexec /passive ou msiexec /quiet
    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
    Pour d'autres installeurs (NSIS, InnoSetup, Install shield), tu peux avoir des options quiet. C'est à tester.Et pour les autres, il faut trouver de la doc.

    En règle générale tous les installations au format MSI acceptent des arguments
    les installations MSI sont parfois cachées dans des setup.exe ou autres fichier.exe

    En Gros ça donne pour installer une application quelconque avec un setup.exe en silence

    setup.exe /s /noreboot
    /s = silencieux
    /qn = sans aucune fenetre durant l'installation
    /noreboot = pas de reboot de l'ordinateur à la fin de l'installation


    pour avoir toute la liste -> DÉMARRER -> EXÉCUTER puis taper msiexec puis la touche 'ENTER'
    vous aurez toute la liste des paramètres MSI

  6. #6
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    d'accord, merci

    je m'étais déjà avancer, pour l'installation c'est nickel.

    Par contre pour la génération du rapport...

  7. #7
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par elokence991 Voir le message
    d'accord, merci
    je m'étais déjà avancer, pour l'installation c'est nickel.
    Par contre pour la génération du rapport...

    Postez votre script pour qu'on puisse avancer avec vous dans ce dernier

  8. #8
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Pour le moment mon script donne ça, mais j'ai des fenêtre qui s'ouvre.
    Comme le choix de langue, les suivant suivant suivant etc...


    C:\Users\xxxxxxx\Desktop\Prog\notepad++\npp.6.3.1.Installer.exe /qn /norestart

  9. #9
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par elokence991 Voir le message
    Pour le moment mon script donne ça, mais j'ai des fenêtre qui s'ouvre.
    Comme le choix de langue, les suivant suivant suivant etc...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @echo off
    Start /Wait npp.6.5.5.Installer.exe /S
    echo Notepad++ est installé avec sucées > LogInstall.txt
    Start LogInstall.txt

  10. #10
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut [VBS] Installation silencieuse de Notepad++ sans aucune fenêtre en Vbscript
    Installation silencieuse de Notepad++ sans aucune fenêtre en Vbscript
    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
    Option Explicit
    Dim MaCmd
    MaCmd = "Start /Wait E:\Test\SilentInstall\npp.6.5.5.Installer.exe /S"&_
    " & echo Notepad++ est installe avec sucees > LogInstall.txt & Start LogInstall.txt"
    Call Executer(MaCmd,0)
    '**************************************************************************************************
    Function Executer(StrCmd,Console)
        Dim ws,MyCmd,Resultat
        Set ws = CreateObject("wscript.Shell")
    'La valeur 0 pour cacher la console MS-DOS
        If Console = 0 Then
            MyCmd = "CMD /C " & StrCmd & " "
            Resultat = ws.run(MyCmd,Console,True)
            If Resultat = 0 Then
    'MsgBox "Success"
            Else
                MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
            End If
        End If
    'La valeur 1 pour montrer la console MS-DOS
        If Console = 1 Then
            MyCmd = "CMD /K " & StrCmd & " "
            Resultat = ws.run(MyCmd,Console,False)
            If Resultat = 0 Then
    'MsgBox "Success"
            Else
                MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
            End If
        End If
        Executer = Resultat
    End Function
    '****************************************************************************************************
    Installation silencieuse pour déploiement

  11. #11
    Membre expert
    Avatar de sachadee
    Homme Profil pro
    AMI DU BAT
    Inscrit en
    Janvier 2013
    Messages
    1 478
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Brésil

    Informations professionnelles :
    Activité : AMI DU BAT
    Secteur : Distribution

    Informations forums :
    Inscription : Janvier 2013
    Messages : 1 478
    Points : 3 768
    Points
    3 768
    Par défaut
    Salut à tous !

    Hackoo très bien ton script.

    Juste une petite remarque :

    echo Notepad++ est installe avec sucees > LogInstall.txt
    Je pense que pour pouvoir affirmer que l'installation est vraiment un succès il faudrait faire 1 ou 2 tests suplementaire.
    Le fait d'avoir lancé l'installation, ne permet pas d'être sûr à 100 % qu'elle se soit conclue avec succès.

    Donc pour chaque Installation je ferais un test de présence de l'exe principale (au minimum).

    ________________________________
    Un p'tit coup de pouce ça fait toujours plaisir, pensez-y !
    ________________________________

  12. #12
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par sachadee Voir le message
    Donc pour chaque Installation je ferais un test de présence de l'exe principale (au minimum).
    Sacha pour le test
    Tu veux dire comment je teste en Batch ou bien en vbscript ou bien un batch dans un Vbscript ?
    de développer plus l'idée car ça m'intéresse moi aussi cette installation silencieuse
    en attendant que notre ami nous réponds voila j'ai téléchargé les derniers versions de quelques softs pour les tester et ils sont dans le même répertoire de ce script batch
    Donc si vous pouvez m'ajouter le test dans ce dernier ça sera sympa with +1 of course for you
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    @echo off
    Start /Wait ccsetup412.exe /S
    echo ************************************ > LogInstall.txt
    echo CCleaner est installé avec sucées >> LogInstall.txt
    ::echo ************************************ >> LogInstall.txt
    Start /Wait npp.6.5.5.Installer.exe /S
    echo ************************************ >> LogInstall.txt
    echo Notepad++ est installé avec sucées >> LogInstall.txt
    ::echo ************************************ >> LogInstall.txt
    start /wait Opera_20.0.1387.91_Setup.exe /silent /launchopera 0 /desktopshortcut 0 /quicklaunchshortcut 0 /pintotaskbar 0 /setdefaultbrowser 0 /allusers
    echo ************************************ >> LogInstall.txt
    echo Opera V 20.0.1387.91  est installé avec sucées >> LogInstall.txt
    ::echo ************************************ >> LogInstall.txt
    Start LogInstall.txt

  13. #13
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    Yeah sa m'a fait beaucoup aidé tout ça !!

    Je suis en train de faire des test, pour le moment c'est pas mal petit rapport a la fin et tout.

    Par contre il m'a sorti une erreur et ne m'a pas installé java, il m'a sorti introuvable mais comme le dernier script donné, sur le rapport il est installé avec succès.


    ************************************
    Adobereader est installé avec succès
    ************************************
    Java est installé avec succès
    ************************************
    Teamviewer est installé avec succès

  14. #14
    Membre expert
    Avatar de sachadee
    Homme Profil pro
    AMI DU BAT
    Inscrit en
    Janvier 2013
    Messages
    1 478
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Brésil

    Informations professionnelles :
    Activité : AMI DU BAT
    Secteur : Distribution

    Informations forums :
    Inscription : Janvier 2013
    Messages : 1 478
    Points : 3 768
    Points
    3 768
    Par défaut
    Par contre il m'a sorti une erreur et ne m'a pas installé java, il m'a sorti introuvable mais comme le dernier script donné, sur le rapport il est installé avec succès.
    C'est exactement ce dont je parlais.

    Il faut tester l'existence de l'exe et l'on peut pousser un peu plus en testant sa taille par exemple (pertinent en cas de téléchargement de l'install).

    Donc si je reprend le script de hackoo :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    @echo off
    Start /Wait ccsetup412.exe /S^& echo.^>fin.val ^& exit
    echo ************************************ > LogInstall.txt
    
    :affiche
    >nul PING localhost -n 2 -w 1000
    if exist fin.val goto:termine
    goto:affiche
    
    :termine
    if exist CHEMIN D'INSTALLATION\CCleaner.exe (echo CCleaner est installé avec sucées >> LogInstall.txt
    )else(echo Probleme lors de l'installation de CCleaner >>LogInstall.txt)
    Je n'ai pas testé, mais voilà l'idée... Le problème sera peut-être de maintenir le 100% silencieux sinon on peut créer le log dans une 2éme phase ou l'on ferait tous
    les tests et on génère le log en conséquence. Ça serait peut-être plus simple à mettre en oeuvre.....

    A+

    ________________________________
    Un p'tit coup de pouce ça fait toujours plaisir, pensez-y !
    ________________________________

  15. #15
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par elokence991 Voir le message
    Yeah sa m'a fait beaucoup aidé tout ça !!
    Je suis en train de faire des test, pour le moment c'est pas mal petit rapport a la fin et tout.
    Par contre il m'a sorti une erreur et ne m'a pas installé java, il m'a sorti introuvable mais comme le dernier script donné, sur le rapport il est installé avec succès.

    Pour qu'on puisse avancer ensemble, postez votre modification au moins pour tester avec vous et

  16. #16
    Membre confirmé Avatar de pitchalov
    Homme Profil pro
    Inscrit en
    Avril 2007
    Messages
    340
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 340
    Points : 582
    Points
    582
    Par défaut
    Bonjour à tous,
    Pour faire avancer le chmilblik, et si l'option VBScript vous intéresse, voici une méthode de test de la validation de l'installation par rapport au code retour de la commande + journalisation.
    Ce code est basé sur celui de hackoofr un peu plus haut.
    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
    '***** Main
    Option Explicit
    'Const LOG_FILE_PATH = "C:\Temp\LogInstall.txt" 'Chemin complet
    Const LOG_FILE_PATH = "LogInstall.txt" 'Chemin relatif, le fichier sera créé dans le répertoire de travail courant
    Dim MaCmd
    Log LOG_FILE_PATH, "***** " & Now & vbCrLf & "Début de l'installation silencieuse de NPP" & vbCrLf & "***"
    'MaCmd = "echo toto > toto.txt" 'test sans install
    MaCmd = "Start /Wait E:\Test\SilentInstall\npp.6.5.5.Installer.exe /S"
    If Executer(MaCmd,0) <> 0 Then
    	Log LOG_FILE_PATH, "Echec lors de l'installation"
    Else
    	Log LOG_FILE_PATH, "Installation de NPP réussie"
    End If
    Log LOG_FILE_PATH, "*** " & Now & vbCrLf & "Fin de l'installation silencieuse de NPP" & vbCrLf & "*****"
    '***
    
    '*****
    Function Executer(StrCmd,Console)
    	'Console : valeur 0 pour cacher la console MS-DOS, valeur 1 pour montrer la console MS-DOS
        Dim ws,MyCmd,Resultat
        Set ws = CreateObject("wscript.Shell")
    	MyCmd = "CMD /C " & StrCmd & " "
    	Log LOG_FILE_PATH, "Lancement de la commande <" & MyCmd & ">"
    	Resultat = ws.run(MyCmd,Console,True)
    	Log LOG_FILE_PATH, "Code retour <" & Resultat & ">"
        Executer = Resultat
    End Function
    '***
    
    '*****
    Sub Log(strLogFilePath,strLogContent)
    	Const APPEND = 8
    	Dim objFso, objLogFile
    	Set objFso = CreateObject("Scripting.FileSystemObject")
    	If Not objFso.FileExists(strLogFilePath) Then objFso.CreateTextFile(strLogFilePath, True).Close
    	Set objLogFile = objFso.OpenTextFile(strLogFilePath, APPEND)
    	objLogFile.WriteLine strLogContent
    	objLogFile.Close	
    End Sub
    '***
    Bonne continuation.

  17. #17
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    et Pitchalov pour ta contribution
    Concernant l'installation silencieuse de Java
    Documentation ==> https://www.java.com/en/download/hel...nt_install.xml
    et http://www.oracle.com/technetwork/ja...2.html#running
    Je l'ai testé et ça fonctionne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jre-8-windows-i586.exe /s /L C:\<path>setup.log
    Remarque : le s est en minuscule et le L en Majuscule

  18. #18
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut [VBS] Téléchargement + Installation silencieuse de PDFCreator

    Je viens juste de terminer ce Vbscript Téléchargement + Installation silencieuse de PDFCreator
    Testez puis votez
    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
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    Option Explicit
    Const LOG_FILE_PATH = "LogInstall.txt"
    Dim Titre,MsgAttente,oExec,fso,ws,Temp,PathScript,Question,MaCmd
    Titre = "Downloading File by © Hackoo 2014"
    Set ws = CreateObject("wscript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(LOG_FILE_PATH) Then fso.DeleteFile(LOG_FILE_PATH)
    Temp = ws.ExpandEnvironmentStrings("%Temp%")
    Call DownloadingFile("http://download.pdfforge.org/download/pdfcreator/PDFCreator-stable?download")
    Titre = "Installation de "& DblQuote("PDFCreator") &" by © Hackoo 2014"
    MsgAttente = "Veuillez patienter. Installation de "& DblQuote("PDFCreator") &" est en cours..."
    Call CreateProgressBar(Titre,MsgAttente)'Creation de barre de progression
    Call LancerProgressBar() 'Launch of the progress bar
    Log LOG_FILE_PATH, String(10,"*") & Now & String(10,"*") & vbCrLf & "Début de l'installation silencieuse de PDFCreator" & vbCrLf & String(70,"*")
    MaCmd = "Start /Wait /Min PDFCreator.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"
    If Executer(MaCmd,0) <> 0 Then
    	Log LOG_FILE_PATH, "Echec lors de l'installation"
    Else
    	Log LOG_FILE_PATH, "Installation de PDFCreator réussie"
    End If
    Log LOG_FILE_PATH, String(10,"*") & Now & String(10,"*") & vbCrLf & "Fin de l'installation silencieuse de PDFCreator" & vbCrLf & String(70,"*")
    Call FermerProgressBar() 'Closing progress bar
    ws.Run LOG_FILE_PATH
    '********************************************************************************************************************
    Sub DownloadingFile(URL)
    	Dim Titre,objFSO,Ws,objXMLHTTP,PathScript,Tab,strHDLocation,objADOStream,Command,Start,File
    	Dim MsgTitre,MsgAttente,StartTime,DurationTime,ProtocoleHTTP
    	Set objFSO = Createobject("Scripting.FileSystemObject")
    	Set Ws = CreateObject("wscript.Shell")
    	PathScript = fso.GetParentFolderName(wscript.ScriptFullName) 'Path of this Vbscript
    	ProtocoleHTTP = "http://"
    	If URL = "" Then WScript.Quit
    	If Left(URL,7) <> ProtocoleHTTP Then
    		URL = ProtocoleHTTP & URL
    	End if
    	File = "PDFCreator.exe"
    	Titre = "Downloading File : " & Dblquote(File) & " © Hackoo 2014"
    	Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
    	strHDLocation = PathScript & "\" & File
    	MsgAttente = "Veuillez patienter. Téléchargement de "& DblQuote("PDFCreator") &" en progression..."
    	Call CreateProgressBar(Titre,MsgAttente)'Creation de barre de progression
    	Call LancerProgressBar() 'Launch of the progress bar
    	StartTime = Timer 'Start the Timer Counter
    	On Error Resume Next
    	objXMLHTTP.open "GET",URL,false
    	objXMLHTTP.send()
    	If Err.number <> 0 Then
    		Call FermerProgressBar()'Closing progress bar
    		MsgBox err.description,16,err.description
    		Exit Sub
    	Else
    		If objXMLHTTP.Status = 200 Then
    			strHDLocation = PathScript & "\" & File
    			Set objADOStream = CreateObject("ADODB.Stream")
    			objADOStream.Open
    			objADOStream.Type = 1 'adTypeBinary
    			objADOStream.Write objXMLHTTP.ResponseBody
    			objADOStream.Position = 0    'Set the stream position to the start
    			If objFSO.FileExists(strHDLocation) Then objFSO.DeleteFile strHDLocation
    			objADOStream.SaveToFile strHDLocation
    			objADOStream.Close
    			Set objADOStream = Nothing
    		End If
    	End if
    	Set objXMLHTTP = Nothing
    	DurationTime = FormatNumber(Timer - StartTime, 0) & " seconds." 'The duration of the script
    	Call FermerProgressBar() 'Closing progress bar
    	ws.Popup "The Download of " & Dblquote(File) & " is finished in " & DurationTime &" !","3","The Download of " & Dblquote(File) & " is finished in " & DurationTime &" !",64
    End Sub
    '****************************************************************************************************
    Sub CreateProgressBar(Titre,MsgAttente)
    	Dim ws,fso,f,f2,ts,ts2,Ligne,i,fread,LireTout,NbLigneTotal,Temp,PathOutPutHTML,fhta,oExec
    	Set ws = CreateObject("wscript.Shell")
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	Temp = WS.ExpandEnvironmentStrings("%Temp%")
    	PathOutPutHTML = Temp & "\Barre.hta"
    	Set fhta = fso.OpenTextFile(PathOutPutHTML,2,True)
    	fhta.WriteLine "<HTML>"
    	fhta.WriteLine "<HEAD>"
    	fhta.WriteLine "<Title>  " & Titre & "</Title>"
    	fhta.WriteLine "<HTA:APPLICATION"
    	fhta.WriteLine "ICON = ""magnify.exe"" "
    	fhta.WriteLine "BORDER=""THIN"" "
    	fhta.WriteLine "INNERBORDER=""NO"" "
    	fhta.WriteLine "MAXIMIZEBUTTON=""NO"" "
    	fhta.WriteLine "MINIMIZEBUTTON=""NO"" "
    	fhta.WriteLine "SCROLL=""NO"" "
    	fhta.WriteLine "SYSMENU=""NO"" "
    	fhta.WriteLine "SELECTION=""NO"" "
    	fhta.WriteLine "SINGLEINSTANCE=""YES"">"
    	fhta.WriteLine "</HEAD>"
    	fhta.WriteLine "<BODY text=""white""><CENTER><DIV><SPAN ID=""ProgressBar""></SPAN>"
    	fhta.WriteLine "<span><marquee DIRECTION=""LEFT"" SCROLLAMOUNT=""3"" BEHAVIOR=ALTERNATE><font face=""Comic sans MS"">" & MsgAttente &"</font></marquee></span></DIV></CENTER></BODY></HTML>"
    	fhta.WriteLine "<SCRIPT LANGUAGE=""VBScript""> "
    	fhta.WriteLine "Set ws = CreateObject(""wscript.Shell"")"
    	fhta.WriteLine "Temp = WS.ExpandEnvironmentStrings(""%Temp%"")"
    	fhta.WriteLine "Sub window_onload()"
    	fhta.WriteLine "    CenterWindow 430,90"
    	fhta.WriteLine "    Self.document.bgColor = ""Orange"" "
    	fhta.WriteLine " End Sub"
    	fhta.WriteLine " Sub CenterWindow(x,y)"
    	fhta.WriteLine "    Dim iLeft,itop"
    	fhta.WriteLine "    window.resizeTo x,y"
    	fhta.WriteLine "    iLeft = window.screen.availWidth/2 - x/2"
    	fhta.WriteLine "    itop = window.screen.availHeight/2 - y/2"
    	fhta.WriteLine "    window.moveTo ileft,itop"
    	fhta.WriteLine "End Sub"
    	fhta.WriteLine "</script>"
    	fhta.close
    End Sub
    '**********************************************************************************************
    Sub LancerProgressBar()
    	Set oExec = Ws.Exec("mshta.exe " & Temp & "\Barre.hta")
    End Sub
    '**********************************************************************************************
    Sub FermerProgressBar()
    	oExec.Terminate
    End Sub
    '**********************************************************************************************
    Function DblQuote(Str)
    	DblQuote = Chr(34) & Str & Chr(34)
    End Function
    '**********************************************************************************************
    Function Executer(StrCmd,Console)
    'Console : valeur 0 pour cacher la console MS-DOS, valeur 1 pour montrer la console MS-DOS
    	Dim ws,MyCmd,Resultat
    	Set ws = CreateObject("wscript.Shell")
    	MyCmd = "CMD /C " & StrCmd & ""
    	Log LOG_FILE_PATH, "Lancement de la commande ==> " & DblQuote(MyCmd)
    	Resultat = ws.run(MyCmd,Console,True)
    	Log LOG_FILE_PATH, "Code retour  ==> " & DblQuote(Resultat)
    	Executer = Resultat
    End Function
    '**********************************************************************************************
    Sub Log(strLogFilePath,strLogContent)
    	Const APPEND = 8
    	Dim objFso, objLogFile
    	Set objFso = CreateObject("Scripting.FileSystemObject")
    	If Not objFso.FileExists(strLogFilePath) Then objFso.CreateTextFile(strLogFilePath, True).Close
    	Set objLogFile = objFso.OpenTextFile(strLogFilePath, APPEND)
    	objLogFile.WriteLine strLogContent
    	objLogFile.Close	
    End Sub 
    '**********************************************************************************************

  19. #19
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    J'ai trouvé ce petit utilitaire pour trouver les switchs de quelques "installeurs" :



    Et aussi un bon article sur les installations silencieuse

    Bonne Lecture

  20. #20
    Futur Membre du Club
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2013
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2013
    Messages : 11
    Points : 7
    Points
    7
    Par défaut
    WoooooooooooooooooooaaaaaaaaWWWWWw

    Tout d'abord un grand merci à vous et veuillez m'excuser pour mon absence.
    Je n'ai pas pu être disponibles pendant plusieurs jours?
    Je vois que vous avez beaucoup avancer dans ces recherches et tests et moi ben je n'ai pas pu avancer du tout.
    Un imprévu qui m'a fait partir à l'étranger.

    Maintenant, je vais prendre le temps de tout lire et de méditer sur chaque messages

Discussions similaires

  1. Réponses: 0
    Dernier message: 14/10/2008, 16h40
  2. [PERL]: Help script traitement fichier txt tabulaire
    Par Piccolupo13 dans le forum Langage
    Réponses: 2
    Dernier message: 21/08/2007, 20h37
  3. Script : Installation Automatique
    Par thopose dans le forum Windows
    Réponses: 2
    Dernier message: 24/04/2007, 23h45
  4. [CENTOS] Script installation serveur web
    Par isa150183 dans le forum RedHat / CentOS / Fedora
    Réponses: 1
    Dernier message: 31/03/2007, 20h37
  5. [SQLServer]Script import fichier .txt
    Par Jenbi dans le forum MS SQL Server
    Réponses: 4
    Dernier message: 25/08/2006, 16h49

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