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
| Titre = " Processus "& qq("Wscript.exe") &" en cours d'exécution "
Set fso = CreateObject("Scripting.FileSystemObject")
Set sho = CreateObject( "Wscript.Shell" )
NomFichierLog="Processus VBScript.txt"
temp = sho.ExpandEnvironmentStrings("%temp%")
PathNomFichierLog = temp & "\" & NomFichierLog
Set OutPut = fso.CreateTextFile(temp & "\" & NomFichierLog,1)
count=0
strComputer = "."
Call FindScript()
Call Explorer(PathNomFichierLog)
'***************************************************************************************************
Function Explorer(File)
Set ws=CreateObject("wscript.shell")
ws.run "Explorer "& File & "\",1,True
end Function
'***************************************************************************************************
Sub FindScript()
Set colItems = GetObject("winmgmts:").ExecQuery("Select * from Win32_Process " _
& "Where Name like '%wscript.exe%' AND NOT commandline like '%" & wsh.scriptname & "%'",,48)
For Each objItem in colItems
'MsgBox "Script : " & objItem.CommandLine,64,Titre
count= count + 1
Msgbox Mid(objItem.CommandLine,InStr(objItem.CommandLine,""" """) + 2),64,Titre
OutPut.WriteLine Mid(objItem.CommandLine,InStr(objItem.CommandLine,""" """) + 2)
Next
OutPut.WriteLine count & Titre
End Sub
'***************************************************************************************************
Function qq(strIn)
qq = Chr(34) & strIn & Chr(34)
End Function
'*************************************************************************************************** |
Partager