Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > VBScript to access task manager list

Thread Tools Display Modes
Old 09-08-2003, 03:01 PM
scottfossum scottfossum is offline
Join Date: Sep 2003
Posts: 2
Default VBScript to access task manager list

I want to know if I can use vbScript to look at the task list of the Task Manager so I can search to see if a specific session of an emulator is running. Windows 2000 and XP

At my job we use an emulator to get on the iSeries. Each user has there own copy of the emulator and profile.ws. We would like to have the Emulator on are Network shared drive. The problem would be each session would load in as the same workstation. I wrote some vbscipt that gets there username of there network loggin creates new profile.ws that becomes there wokstation ID for the emulator. What i need now is one more step when a user launches an emulator it can check there task manager to see if any other sessions are running so the appropriate name can be used. exp. userID johnD and in the task manager of there computer has session A, session C. currently running then it is safe to start the next session with johnD2, becasue johnD1 and johnD3 are allready running.
This was my first post my appoligies if a got long winded any help would be appreciated.
Reply With Quote
Old 09-10-2003, 12:30 AM
ionutb ionutb is offline
Join Date: Sep 2003
Location: bucharest
Posts: 9

Task manager is a program. To get running processes you need api calls, i dont know if u can call api functions from scripts thats why u shld create a com object with vb and call it from ur script.
Reply With Quote
Old 09-10-2003, 06:45 AM
alp0001's Avatar
alp0001 alp0001 is offline
Ultimate Contributor

Retired Moderator
* Expert *
Join Date: Jan 2002
Location: Round Lake Heights, IL
Posts: 2,821

Yes, you can call APIs through script, one just needs to download an ocx.
Avatar by the very talented member: lebb
Reply With Quote
Old 09-11-2003, 09:47 PM
FreakOZ FreakOZ is offline
Junior Contributor

* Expert *
Join Date: Sep 2002
Location: Sydney, Australia
Posts: 228

You can use the Win32_Process class in WMI..

here is an example

Dim objWMIService, colItems, objItem, strComputer strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.InstancesOf("Win32_Process") For Each objItem In colItems WScript.Echo objItem.ProcessId & ":" & objItem.Name Next Set objWMIService = Nothing Set colItems = Nothing
Reply With Quote
Old 09-16-2003, 07:11 AM
scottfossum scottfossum is offline
Join Date: Sep 2003
Posts: 2
Default One more thing

Thank you all for your help.
I researched more about the Win32 stuff there is alot of cool stuff. The sample code works good it recieves the processes. I need one more thing. The process only shows the executable that was used to run the emulator. So when you have four copies of the emulator running it shows the same program running four times. What I need is the Application name that shows up in the task manager or atleast some other indicator of what session of the emulator each occurence is. Thanks again for your help. I'm going to keep playing around with the many different WIn32_ stuff and maybe I 'll come across the answer.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Intellisense usetheforce2 Miscellaneous Languages 10 10-16-2002 07:48 PM
hiding a program from task manager tigz API 10 08-30-2002 06:49 PM
Hiding my prgrams from Task manager list ? visualbasic700e General 3 04-01-2001 07:21 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..