![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | run vbs.script and give it a procesname in Task Manager Hi Group Haw do I make a vbs script telling Windows Task Managera name like "My_proces.vbs". I'd like to have a vbs script running in a loop monitoring something and make it appear in task manager with a cpecifik name. Cheers Leon |
My System Specs![]() |
| | #2 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager On Feb 6, 7:34*am, Leon <kim.zeth...@xxxxxx> wrote: Quote: > Hi Group > > Haw do I make a vbs script telling Windows Task Managera name like > "My_proces.vbs". > > I'd like to have a vbs script running in a loop monitoring something > and make it appear in task manager with a cpecifik name. > > Cheers Leon My_process.exe and then use it to launch your script, but I don't think you can do anything to change the extension to VBS. However, there may be a better way to determine what script is running using WMIs Win32_Process class to locate the correct process. That class has a CommandLine property that will identify what script was executed to start the process. From that information you can match or parse out the script's name. Here is a script that illustrates this capability ... ' Get list of running processes using WMI sComputer = "." ' Local computer with GetObject("winmgmts:\\" & sComputer & "\root\cimv2") Set cItems = .ExecQuery("Select * From Win32_Process") end with Set DataList = CreateObject("System.Collections.ArrayList") nCnt = 0 For Each oItem in cItems DataList.Add Left(oItem.Name & " ",12) & vbTab & oItem.ProcessID _ & vbTab & nCnt & vbTab & oItem.Commandline nCnt = nCnt + 1 Next DataList.Sort() 'DataList.Reverse() s = "<xmp style='font:10pt Lucida Console'>Process Name " _ & "ID Seq # Command Line" & vbNewline & vbNewline For Each sItem in DataList s = s & sItem & vbNewline Next ' Display results in a scrollable window height = 600 : width = 800 set oIE = CreateObject("InternetExplorer.Application") With oIE .RegisterAsDropTarget = False .toolbar = False: menubar = False: statusbar = False .width = Width : .height = Height .Navigate "about:blank" Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop With .document .open .write s & "</xmp>" .Close .title = "Processes" end with .Visible = True end with ' oIE Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager Hi Leon, Quote: > Hi Group > > > Haw do I make a vbs script telling Windows Task Managera name like > "My_proces.vbs". > > I'd like to have a vbs script running in a loop monitoring something > and make it appear in task manager with a cpecifik name. > > > Cheers Leon Set up a new project in vb6 and add a reference to wsh to the project. Then you should be able to paste the code from a vbs.. compile... Finaly you can see your exe in Taskmanager and catch it via vbs in a way like this.. Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process") For Each objProcess in colProcessList If objProcess.name = "my.exe" then vFound = True Next If vFound = True then ..... End If regards Dirk |
My System Specs![]() |
| | #4 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager -- Jeff C Live Well .. Be Happy In All You Do "Tom Lavedas" wrote: Quote: > On Feb 6, 7:34 am, Leon <kim.zeth...@xxxxxx> wrote: Quote: > > Hi Group > > > > Haw do I make a vbs script telling Windows Task Managera name like > > "My_proces.vbs". > > > > I'd like to have a vbs script running in a loop monitoring something > > and make it appear in task manager with a cpecifik name. > > > > Cheers Leon > You can make a copy of Wscript.exe or Cscript.exe with a name like > My_process.exe and then use it to launch your script, but I don't > think you can do anything to change the extension to VBS. > > However, there may be a better way to determine what script is running > using WMIs Win32_Process class to locate the correct process. That > class has a CommandLine property that will identify what script was > executed to start the process. From that information you can match or > parse out the script's name. > > Here is a script that illustrates this capability ... > > ' Get list of running processes using WMI > > sComputer = "." ' Local computer > with GetObject("winmgmts:\\" & sComputer & "\root\cimv2") > Set cItems = .ExecQuery("Select * From Win32_Process") > end with > > Set DataList = CreateObject("System.Collections.ArrayList") > > nCnt = 0 > For Each oItem in cItems > DataList.Add Left(oItem.Name & " ",12) & vbTab & > oItem.ProcessID _ > & vbTab & nCnt & vbTab & oItem.Commandline > nCnt = nCnt + 1 > Next > DataList.Sort() > 'DataList.Reverse() > > s = "<xmp style='font:10pt Lucida Console'>Process Name " _ > & "ID Seq # Command Line" & vbNewline & vbNewline > For Each sItem in DataList > s = s & sItem & vbNewline > Next > > ' Display results in a scrollable window > height = 600 : width = 800 > set oIE = CreateObject("InternetExplorer.Application") > With oIE > .RegisterAsDropTarget = False > .toolbar = False: menubar = False: statusbar = False > .width = Width : .height = Height > .Navigate "about:blank" > Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop > With .document > .open > .write s & "</xmp>" > .Close > .title = "Processes" > end with > .Visible = True > end with ' oIE > > Tom Lavedas > *********** > http://there.is.no.more/tglbatch/ I have numerous scheduled tasks executing vbs scripts and batch file with command lines which I would like to monitor. Returning a list of the tasks and their completion status to a printer or an email every morning would be really great. Is this something close to a script that would accomplish this? Is there a script out there that would? Thanks in advance. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager Tom Lavedas wrote: Quote: > However, there may be a better way to determine what script is running > using WMIs Win32_Process class to locate the correct process. That > class has a CommandLine property that will identify what script was > executed to start the process. From that information you can match or > parse out the script's name. > > Here is a script that illustrates this capability ... > > ' Get list of running processes using WMI > > sComputer = "." ' Local computer > with GetObject("winmgmts:\\" & sComputer & "\root\cimv2") > Set cItems = .ExecQuery("Select * From Win32_Process") registered" message. I have registered WBEMDISP.DLL and regsvr32 reports sucess, but still get the message above. I have tried several times but don't recall ever getting WMI scripts to work on my Windows 98 machine. ![]() -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #6 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager On Feb 7, 12:18*pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: > Tom Lavedas wrote: Quote: > > However, there may be a better way to determine what script is running > > using WMIs *Win32_Process class to locate the correct process. *That > > class has a CommandLine property that will identify what script was > > executed to start the process. *From that information you can match or > > parse out the script's name. Quote: > > Here is a script that illustrates this capability ... Quote: > > ' Get list of running processes using WMI Quote: > > sComputer = "." ' Local computer > > with GetObject("winmgmts:\\" & sComputer & "\root\cimv2") > > * Set cItems = .ExecQuery("Select * From Win32_Process") > In Windows 98, the script stops on line above with a "Library not > registered" message. I have registered WBEMDISP.DLL and regsvr32 reports > sucess, but still get the message above. I have tried several times but > don't recall ever getting WMI scripts to work on my Windows 98 machine. ![]() > > -- > Todd Vargo > (Post questions to group only. Remove "z" to email personal messages) It's been a long time since I ran on a Win98 equipped machine, but WMI is supposed to support that OS, at least most of its functions (Win32_Process being one of the supported classes). Did you download the Win98 specific version of the Core? Try uninstalling it and reinstalling with the download from here: http://www.microsoft.com/downloads/d...displaylang=en Other than that. I don't know what to say. HTH, Tom Lavedas |
My System Specs![]() |
| | #7 (permalink) |
| | Re: run vbs.script and give it a procesname in Task Manager Tom Lavedas wrote: Quote: > Todd Vargo wrote: Quote: >> Tom Lavedas wrote: Quote: >>> However, there may be a better way to determine what script is >>> running using WMIs Win32_Process class to locate the correct >>> process. That class has a CommandLine property that will identify >>> what script was executed to start the process. From that >>> information you can match or parse out the script's name. Quote: >>> Here is a script that illustrates this capability ... Quote: >>> ' Get list of running processes using WMI Quote: >>> sComputer = "." ' Local computer >>> with GetObject("winmgmts:\\" & sComputer & "\root\cimv2") >>> Set cItems = .ExecQuery("Select * From Win32_Process") >> In Windows 98, the script stops on line above with a "Library not >> registered" message. I have registered WBEMDISP.DLL and regsvr32 >> reports sucess, but still get the message above. I have tried >> several times but don't recall ever getting WMI scripts to work on >> my Windows 98 machine. ![]() >> >> -- >> Todd Vargo >> (Post questions to group only. Remove "z" to email personal messages) > Todd, > > It's been a long time since I ran on a Win98 equipped machine, but WMI > is supposed to support that OS, at least most of its functions > (Win32_Process being one of the supported classes). Did you download > the Win98 specific version of the Core? Try uninstalling it and > reinstalling with the download from here: > > http://www.microsoft.com/downloads/d...lyId=98A4C5BA- > 337B-4E92-8C18-A63847760EA5&displaylang=en > > Other than that. I don't know what to say. now I get this error message. "ActiveX component can't create object: 'System.Collections.ArrayList'" Apperantly, .net is required to be installed for that object so I removed referances to DataList object and tried to just echo the display to command window. Now I get, "Object doesn't support this property or method: 'oItem.Commandline'". Unfortunatly for me, the .CommandLine property (and other property/methods) are not available in 9x/NT/2K. http://msdn.microsoft.com/en-us/libr...99(VS.85).aspx Thanks for the discussion Tom. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Need help for task manager!! | General Discussion | |||
| Script to give user modify permission | VB Script | |||
| Why task manager has sidebar more than 1 task ?? | Vista General | |||
| Task Manager not terminating task. | Vista performance & maintenance | |||
| Task manager | Vista General | |||