I have been trying for sometime to launch URLs in tabs within Internet Explorer. While I have been successful, it fails more times that succeeds. The error message is always the same: The interface is unknown. (Exception from HRESULT: 0X800706B5). I can always get the first item to launch, but it always seems to fail at the second or third item. The items are an array built from a semi-colon separated list. My code is below.
Any assistance will be greatly appreciated.
____
$CurrentURLsArray = $CurrentURLs.Split(";")
$navOpenInBackgroundTab = 0x1000;
$ie = new-object -com InternetExplorer.Application
$ie.Visible = $true;
foreach ($item in $CurrentURLsArray)
{
Try
{
if ($item -eq $CurrentURLsArray[0]) { $ie.Navigate2($item); }
Else
{
$ie.Navigate2($item, $navOpenInBackgroundTab);
}
}
Catch
{
$FailedApps = 1
$ErrorMessage = $_.Exception.Message
"Failed to launch URL - $item" | Out-File $LogFile -Append
"Error Message: $ErrorMessage" | Out-File $LogFile -Append
}
}
____
Product, version and build: Powershell Studio 2018 5.5.153
32 or 64 bit version of product: 64-bit
Operating system:
32 or 64 bit OS: 64-bit
Launch URLs in Internet Explorer Tabs
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Launch URLs in Internet Explorer Tabs
[TOPIC MOVED TO WINDOWS POWERSHELL FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Launch URLs in Internet Explorer Tabs
Note the message on the top of this page: "Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file."
You have to wait until the page loads before specifying a new page.
While($ie.Busy){sleep 1}
Also IE will not cause an exception on a failed navigate. "Try/Catch" is not very useful here. If you are getting exceptions then there is some other issue with you browser.
You have to wait until the page loads before specifying a new page.
While($ie.Busy){sleep 1}
Also IE will not cause an exception on a failed navigate. "Try/Catch" is not very useful here. If you are getting exceptions then there is some other issue with you browser.