Get process ID from Com Object
Asked Answered
M

1

9

It is possible to get the Process ID from this new Com Object ($ie) ?

$ie=New-Object -comobject InternetExplorer.Application  
$ie.visible=$true  
$ie.Navigate("www.stackoverflow.com")
Messroom answered 29/11, 2010 at 14:24 Comment(3)
Can you explain what you want to use the process ID for? Please note that IE is special as it creates new processes for each tab.Chaw
Thanks 0xA3 for your answer! I want to check CPU(s). (I know the propertys $ie.busy and $ie.readystate from the Com Object)Messroom
Determine the Process ID of the Client Process communicating with a COM RPC Server + How can the caller's process be identified in an ATL COM+ out-of-proc server application?.Brillatsavarin
C
8

The following will give you the parent IE process:

(Get-Process -Name iexplore)| Where-Object {$_.MainWindowHandle -eq $ie.HWND}
Chaw answered 29/11, 2010 at 14:54 Comment(1)
What if you have multiple IE processes open?Waldenses

© 2022 - 2024 — McMap. All rights reserved.