I omitted one bit, right before the last paragraph--I never said what "this method" is that I had some partial success with. Here's what it should have been...
....
That's based on what I found here:
http://www.microsoft.com/technet/scriptcenter/resources/pstips/nov07/pstip1130.mspxNow what I wound up doing is checking the $objIE.ReadyState, and if it's not in the valid range (0-4), I then try to take control of the existing IE process, and if that fails, then I try to kill any existing iexplore.exe processes and spawn a new instance if IE. Here's the code for that:
if(($objIE.ReadyState -ne 0) -AND ($objIE.ReadyState -ne 1) -AND ($objIE.ReadyState -ne 2) -AND ($objIE.ReadyState -ne 3) -AND ($objIE.ReadyState -ne 4))
{
$objIE = [System.Runtime.InteropServices.Marshal]::GetActiveObject("InternetExplorer.Application")
if(($objIE.ReadyState -ne 0) -AND ($objIE.ReadyState -ne 1) -AND ($objIE.ReadyState -ne 2) -AND ($objIE.ReadyState -ne 3) -AND ($objIE.ReadyState -ne 4))
{
Stop-Process -processname iexplore
$objIE = New-Object -ComObject "InternetExplorer.Application"
}
}Now, I found that with this method, the task ran successfully for several days, but then hung at "while($objIE.Busy)" loop. It seems like it got stuck in that loop and never got any further. It's like the page never finished loading--even after 10 hours had gone by. Seems like by that time it would have timed out, at the very least...