Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create a script in QTP to get all the processes in a system
#2
Solved: 12 Years, 10 Months, 3 Weeks ago
Below is code,

if you use "." for strComputer, it will fetch the details of the local machine.
If you want to fetch the list of process running in a remote machine, use the machine id in place of ".".
E.g.:

Code:
strComputer = "REMOTE-MACHINE100"
--
Dim Process, strComputer
Process = ""
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process")

count = 0
For Each objProcess in colProcess
    Process = Process + vbnewline + objProcess.Name
    count = count + 1
Next

Print Process

Set objWMIService = Nothing
Set colProcess = Nothing

Hope this helps...

Thanks,
Elango
Reply


Messages In This Thread
RE: How to create a script in QTP to get all the processes in a system - by elango87 - 12-06-2012, 04:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make QTP Script to work when system gets locked? ramkumarad 6 13,671 11-02-2017, 03:37 PM
Last Post: Divv
  Create a wrap for the main script ? Linuxuser 0 1,986 02-07-2017, 12:08 AM
Last Post: Linuxuser
  cannot create java virtual machine on QTP 12.02 version richa5685 0 2,319 02-23-2016, 11:18 AM
Last Post: richa5685
  Local System Monitor kbhargava505 0 2,773 10-16-2015, 12:52 PM
Last Post: kbhargava505
  QTP system related issue Bharathi Kanagarajan 1 2,423 09-12-2015, 11:28 PM
Last Post: ADITI1992

Forum Jump:


Users browsing this thread: 1 Guest(s)