Procces notepad restant actif.
Bonjour a tous
J'ai un petit scripts qui m'extrait des informations du journal d'evenment windows pour en faire un fichier texte. ce fichier texte etant lui meme exploité par un autre scripts sur une autre machin. le tout etant automatisé.
Mon probleme est qu'il y a un process notepad qui se créer a chaque execution et qui reste par la suite actif. ce qui sature la machine au bout de quelque execution.
voici la source:
Code:
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
|
'Lecture des enregistrements des journaux d'événements de Windows
On Error Resume Next
'Création fichier resultat
Dim resultat : resultat = "\\machine_unix\rapport_sauvegarde\rapport_" & wscript.arguments(0) & ".txt"
Dim Fso : Set Fso = CreateObject("Scripting.fileSystemObject")
Dim Rapport : Set Rapport = Fso.openTextFile(resultat, 2, True)
Dim strComputer, objWMIServices, objWMIObjectSet, objWMIObject
strComputer = "machine_windows"
Set objWMIServices = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objWMIObjectSet = objWMIServices.ExecQuery _
("Select * from Win32_NTLogEvent Where LogFile='Application'And Category='3' ")
For Each objWMIObject In objWMIObjectSet
If DateDiff("h", clair(objWMIObject.TimeGenerated),now ) <= 24 Then
Rapport.writeLine " " & objWMIObject.Message
Rapport.writeLine "FINLOG"
End If
Next
Rapport.Close
Set Rapport = Nothing
Set fso = Nothing : Set Rapport = Nothing
Set objWMIObjectSet = Nothing : Set objWMIServices = Nothing
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.Run resultat
Set WshShell = Nothing
WScript.Quit
Function clair(temps)
'tranformation de la date "aaaammjjhhmnss" en jj/mm/aaaa hh:mn
Dim debut, an, mois, jour, hhmn
debut = left(temps,8)
an = left(debut,4)
mois = mid(debut,5,2)
jour = right(debut,2)
hhmn = " " & Mid(temps,9,2) & ":" & Mid(temps,11,2) & ":" & Mid(temps,13,2)
clair = CStr(mois) & "/" & CStr(jour) & "/" & CStr(an) & CStr(hhmn)
'MsgBox temps &vbCrLf& clair
End function |
voila tout fonctionne parfaitement, les evenements traitant des sauvegardes des 24 dernieres heures sont extrait vers le fichiers text sans soucis, il a juste le process notepad qu'il reste. comment faire pour ne plus avoir le process apres l'execution du scripts?