IE powershell

PowerShell: Accessing Data in IFRAME in IE Com Object

A lot of my work involves using PowerShell and the IE com object to extract data. We’ve got a VOIP system at work that is really inflexible and doesn’t have any “critical level” functionality – ex: supervisors need to be notified if the call center’s current on-hold levels are extreme. The problem has been that the intranet portal with this information is javascript-crazy stacked on top of multiple IFRAMES and all sorts of nesting. Getting access to a specific IFRAME with all of that going on took a lot of patience, but I want to share it in case anybody else runs into this (or I forget how I accessed it).

This gets you the source html of the iframe in string format. You can then do all the string manipulation necessary to get your work done.

$html = $ie.Document.IHTMLDocument3_getElementById("The_IFRAME_ID").contentWindow.IHTMLWindow2_document.body.IHTMLElement_outerHTML