Page 1 of 1 1
Topic Options
#178485 - 2007-07-26 09:58 PM Retrieving list of tasks from Task Manager using COM Object in Kixtart.
MarcInCa Offline
Fresh Scripter

Registered: 2007-06-05
Posts: 22
Loc: Montreal, Canada
Hi folks,

First my apologies english is my second language. Ill try to be clear with my problem.

I got a challenging problem. I am using Kixtart to run installation programs from 3rd party softwares. This is to automate the process of installing lots of programs quickly. So Far soo good.

My problem I got is one of the install program is running in silent mode and most of the installation is done in the background. The main install basically start many threads of smaller installs and the main program is done. It leaves several smaller setup.exe and msiexec.exe running in the background. I know among them setup.exe , one is running controlling the rest but it too is also running in the background.

No direct way to tell it run in the foreground.

I was hoping i could find a way to get the list of all Tasks from the Task manager using a COM object which would return the Tasks Object collection.

With the Object, I should be able to get the list of tasks which could be copied into an array then parse the array to see if the "setup.exe" task is no longer present in the array. That way I would know the installation in the background is done and I can order kixtart to reboot the machine and continue the other install.

I know it does not sound easy but I sense someone in this great gang of peoples \:D as at least been able to retrieve the list of tasks using Kixtart.

Your help will be deeply apprciated. Thank you \:\)
_________________________
Treat people the way you want to be treated.

Top
#178486 - 2007-07-26 10:14 PM Re: Retrieving list of tasks from Task Manager using COM Object in Kixtart. [Re: MarcInCa]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
This is straight-forward with WMI. There might be a canned user-defined function for this - that returns an array, maybe WMIQuery not sure, but here's code to get you started. This script dumps-out all the running processes on the workstation - and hi-lites any that have "explore" as part of its name ...

 Code:
Break on

$WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + @WKSTA + "\root\cimv2")

$Processes = $WMI.ExecQuery("Select * FROM Win32_Process")

For Each $Process in $Processes

 If InStr($Process.Name,"Explore")

  color g+/n

 Endif

 ? $Process.Name

 color w/n

Next

Top
#178516 - 2007-07-27 03:37 PM Re: Retrieving list of tasks from Task Manager using COM Object in Kixtart. [Re: Shawn]
MarcInCa Offline
Fresh Scripter

Registered: 2007-06-05
Posts: 22
Loc: Montreal, Canada
Hooo ! This is Niceee ! Thank you very much Shawn for the quick response.
This will be very helpful for me.

OK quick question is WMI already part of Windows XP ? Is this what we call "Windows Scripting" ?

Sorry It's friday morning. I am running without coffee at the moment. heheheh ! \:\)
_________________________
Treat people the way you want to be treated.

Top
#178518 - 2007-07-27 03:45 PM Re: Retrieving list of tasks from Task Manager using COM Object in Kixtart. [Re: MarcInCa]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yes it is part of Windows XP, it is not "Windows Scripting" though; It's more like "Windows Management Instrumentation" ;\)
_________________________



Top
#178519 - 2007-07-27 03:49 PM Re: Retrieving list of tasks from Task Manager using COM Object in Kixtart. [Re: Jochen]
MarcInCa Offline
Fresh Scripter

Registered: 2007-06-05
Posts: 22
Loc: Montreal, Canada
Excellent ! Thank you again every one ! This really makes my day !I will integrate this code into a function.

Thank you again ! OK Time for coffee. I got code to write. \:\)
_________________________
Treat people the way you want to be treated.

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1527 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.043 seconds in which 0.02 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org