Just another WordPress site

Monat: Februar 2014

VBScript – Getting Script Name from wscript.exe Process

Set objWMIService = GetObject(„winmgmts:“ _
& „{impersonationLevel=impersonate}!\\“ _
& „.“ & „\root\cimv2“)

Set colProcesses = objWMIService.ExecQuery( _
„Select * from Win32_Process “ _
& „Where Name = ‚WScript.exe'“, , 48)

Dim strReport
For Each objProcess in colProcesses
‚ skip current script, and display the rest
If InStr (objProcess.CommandLine, WScript.ScriptName) = 0 Then
strReport = strReport & vbNewLine & vbNewLine & _
„ProcessId: “ & objProcess.ProcessId & vbNewLine & _
„ParentProcessId: “ & objProcess.ParentProcessId & _
vbNewLine & „CommandLine: “ & objProcess.CommandLine & _
vbNewLine & „Caption: “ & objProcess.Caption & _
vbNewLine & „ExecutablePath: “ & objProcess.ExecutablePath
End If
Next
WScript.Echo strReport