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
#1
Solved: 11 Years, 4 Months ago
I tried to fetch all the processess in a system using WMI and QTP is not recognising the object.Can anyone help me in getting the code to fetch the list of all the processes running in a system?
Reply
#2
Solved: 11 Years, 4 Months 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
#3
Solved: 11 Years, 4 Months ago
HI for getting process of remotr machine its not fetching process... In case if its not fetching becuase of authentication issue.. let me know the code pls...
Reply
#4
Solved: 11 Years, 4 Months ago
Thanks for the reply
Reply
#5
Solved: 11 Years, 4 Months ago
If you are in a network, you should have access to the machine from which you are trying to fetch the processes. It wont work otherwise.

Thanks,
Elango
Reply
#6
Solved: 11 Years, 4 Months ago
Thank U SmileSmile
Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)