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
| 'Declaration variables
Dim appli
Dim domaine
Dim VERSION
Dim Log
VERSION="1.00"
Dim objFSO,FileLog,fso,ObjFile
Dim objShell
Dim Centre
computer="."
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
appli=appli1;appli2;appli3;appli4
domaine=domaine1;domaine2;domaine3;domaine4
Lock="c:\program\" & appli & "\" & domaine & "\".".schedukler.lock"
Sub supp_lock
msglog "0","0000","-Debut: Suppression du fichier computer.schedukler.lock"
If Fso.FileExists("Lock" ) Then
Set ObjFile = Fso.GetFile("Lock" )
ObjFile.Delete
End If
end if
msglog "0","0000","-Fin: Suppression du fichier computer.schedukler.lock"
end sub
'Localisation des fichiers logs
Log="E:\appli\Log\Demarrage_Services\Demarrage_Services.log"
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set FileLog = FSO.CreateTextFile(Log)
MyDate = Day(Now) & "." & Month(Now) & "." & Year(Now)
Sub Msglog(severite,code,label)
Wscript.echo Mydate & "-" & time & " " & severite & " " & code & " " & label
FileLog.WriteLine(Mydate & "-" & time & " " & severite & " " & code & " " & label)
end sub
Sub Demarre_Service(Nom_Service)
Dim Commande
Dim Tempo
msglog "0","0000","---Debut: Démarrage des service " & Nom_Service
set objShell = WScript.CreateObject("WScript.Shell")
'Tempo=" """& Nom_Service &""" "
Tempo=" """& Nom_Service &""" "
Commande="net start" & Tempo
Wscript.echo Commande
objShell.run(Commande)
wscript.sleep 60000
msglog "0","0000","---Fin: Demarrage des service " & Nom_Service
end sub
'---------------------------
' Corps su script
'---------------------------
msglog "0","0000","---Debut: StartServices.vbs "
msglog "0","0000","VERSION: " & VERSION
supp_lock
Demarre_Service "appli1"
Demarre_Service "appli2"
Demarre_Service "appli3"
Demarre_Service "appli4"
msglog "0","0000","---Fin: StartServices.vbs"
FileLog.Close |
Partager