I need to use PowerShell to capture the F12 application code/logs for diagnosis purposes from IE and can easily do this with the following code:
>> $oIE=new-object -com internetexplorer.application
>> $oIE.Visible = $true
>> $oIE.Document.documentElement | out-file -filepath(“c:\users\antho\desktop\IE.txt”)
But I then need to be able to do this on a system where I did not start IE, and need to find which browser is pointing to the site I am interested in.
I know I can find IE with the following:
PS C:\Windows\system32> get-process iexplore
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id SI ProcessNa
634 43 13524 43236 ...53 4.13 12424 4 iexplore 824 54 53824 71488 474 243.27 74916 4 iexplore 934 59 76052 96608 491 98.11 131556 4 iexplore
However I then want to be able to test each iexplore to see which one is running the web session I am interested in.
I know that I can use $oIE.document.documentElement from above, but what I don’t know is how to do this with the three iexplore sessions that I just identified. Ideally I want to be able to test each of the domains or web address and then grab the .documentElement for that browser.
I have spent a couple of days trying to crack this I seem to be running in circles.
Any pointers here would be fabulous.