VBScript et journal d'événement
Bonjour, j'ai complété un script que j'ai trouvé sur le net concernant la suppression de fichiers temporaires. Seulement je cherche à inscrire dans le journal d'événement, d'une part si la suppression de tel ou tel fichier s'est bien réalisé, et d'autre par une erreur,si ce fichier ne s'est pas supprimer correctement.
Voici mon code VBS
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
|
' This WSH script deletes files in all users' temp folders
'======================
Dim WshSysEnv, WshShell, userprof, WSHFso, WshNetwork
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set WSHFso = WScript.CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objFSO = createobject("Scripting.filesystemobject")
Set WshSysEnv = WshShell.Environment("Process")
userprof = WshSysEnv("userprofile")
'SUPPRESSION DES FICHIERS INUTILES
Set oShell = CreateObject("Wscript.Shell")
'oShell.Run "%Comspec% /C RD /S /Q ""%USERPROFILE%\COOKIES"" ", 0, true
'On error resume next1
oShell.Run "%Comspec% /C RD /S /Q ""%USERPROFILE%\AppData\local settings\Tempor~1"" ", 0, True
On error resume next
oShell.Run "%Comspec% /C RD /S /Q ""c:\TEMP"" ", 0, True
On error resume next
oShell.Run "%Comspec% /C RD /S /Q ""%USERPROFILE%\AppData\local settings\Temp"" ", 0, True
On error resume next
'SUPPRIME LES FICHIERS IE TEMP'
oShell.Run "%Comspec% /C RD /S /Q ""%USERPROFILE%\AppData\local settings\Microsoft\Windows\Temporary Internet Files"" ", 0, True
On error resume next |
Pourriez vous m'aider à introduire ce rapport dans le journal windows ? je sais que je dois utiliser l'élément "WriteToEventViewer" mais je ne sais pas du tout comment faire ??!! ;)