Geeko80
asked on
How do i get a vbscript to show up with a certain process name in task manager?
I come from shell scripting and any time i run a shell script i can see the name of the script when I search for processes running on my linux box, but for a vbscript is shows up as wscript.exe. How can i start a vbscript name rather than it just showing up as wscript.exe?
... Since you originally asked for VBScript, the code below will show a message box showing all WScript.exe and CScript.exe processes.
Regards,
Daz.
'# D.Collins - 09:55 16/09/2010
'# Search for WScript.exe and CScript.exe processes on the local machine
Option Explicit
Dim strProc
strProc = fGetCommandLines("WScript.exe")
strProc = strProc & fGetCommandLines("CScript.exe")
MsgBox strProc,, "WSH Processes:"
Function fGetCommandLines(sPattern)
Dim oWMIService, colProcesses, strProcesses, oProcess, blTemp
Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcesses = oWMIService.ExecQuery("Select * from Win32_Process Where Name = '" & sPattern & "'")
strProcesses = ""
For Each oProcess in colProcesses
strProcesses = strProcesses & oProcess.CommandLine & vbCrlf
Next
If strProcesses = "" Then strProcesses = "No Processes with '" & sPattern & "' found."
fGetCommandLines = strProcesses
End Function
ASKER
Hello, Sorry I wasnt clear.
I am running Windows XP.
I meant to ask how I can get a vbscript to show up with a name of my choosing in task manager rather than just wscript.exe. Can that be coded?
I am running Windows XP.
I meant to ask how I can get a vbscript to show up with a name of my choosing in task manager rather than just wscript.exe. Can that be coded?
You would probably have to write your own task manager application.
The only way I can think of to change the 'WScript.exe' showing in the built-in Task Manager would be to copy WScript.exe and rename it to something else, then call your vbscript with the copied .exe, for example:
1. Copy WScript.exe and rename the copy to Superscript.exe
2. Run: Superscript.exe yourscript.vbs
Regards,
Daz.
tm.jpg
The only way I can think of to change the 'WScript.exe' showing in the built-in Task Manager would be to copy WScript.exe and rename it to something else, then call your vbscript with the copied .exe, for example:
1. Copy WScript.exe and rename the copy to Superscript.exe
2. Run: Superscript.exe yourscript.vbs
Regards,
Daz.
tm.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
You don't say what OS you are using, but assuming it is at least XP then the following command will show you all the vbscript processes running (run in Cmd.exe window):
wmic process get commandline | find /i "wscript.exe"
... or ...
wmic process get commandline | find /i "cscript.exe"
... or even ...
wmic process get commandline | find /i "script.exe"
... you get the idea :o)
Hope this helps,
Daz.