How do I access the classic Internet Explorer COM automation object for a running instance of Internet Explorer? That is, if I have Internet Explorer open in multiple windows, how do I associate the COM object corresponding to one of those windows with a variable in Powershell, from within Powershell? The closest I have come to doing this is obtaining the processes ‘iexplore’ and ‘ieuser’ via get-process.
How do I access the classic Internet Explorer COM automation object for a running
Share
Usually, to obtain access to a COM interface on an existing object, you would use the running object table. Unfortunately, Internet Explorer doesn’t register itself with the running object table – but nevertheless, this provides us with some useful Google search results.
For example, Googling ‘running object table’ ‘internet explorer’ found me How to connect to a running instance of Internet Explorer which provides a (VBScript?) sample demonstrating the use of the ShellWindows object.
A quick ‘n dirty (no error checking!) translation of this sample to PowerShell script gives us: