Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

Get PID number

1 reply to this topic


  • Full Members
  • 1 posts

Posted 10 March 2008 - 12:49

Hi all

Does anybody know how to find the PID of a particular java application? Since all the java apps are shown as java.exe in the task manager only PID's will differenciate app A from app B.

I will appreciate if anybody can help. It does not matter how we get the PID (I mean programatically or thru command prompt or native code or any other way).

Please help!!


  • Full Members
  • 436 posts

Posted 11 March 2008 - 14:06

This is ripped from a script I have. It obviously requires WMI on the running workstation but I guess that's a given nowadays.


       strComputer   = "."
blnProcessRunning = False

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

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

For Each objProcess in colProcess
 strProcessName = objProcess.Name
 lngProcessID = objProcess.ProcessID

 WScript.Echo "Process '" & strProcessName & "' has the process ID " & lngProcessID

Set colProcess   = Nothing
Set objWMIService  = Nothing

Edited by VBScab, 11 March 2008 - 14:07.

- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.