Open All Web Apps in Internet Explorer Using PowerShell

Hi Admins,

I am working on a Script where I should be able to launch all the web applications in the browser to open in tabs. I have worked out with the following script and was able to come upto an extent where I am able to launch the Internet Explorer.But ....only 1 web app opens up and throws an error message :

Exception calling "Navigate" with "1" argument(s): "The interface is unknown. (Exception from HRESULT: 0x800706B5)".

Below is my script

Add-PSSnapin Microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$webApps = Get-SpWebapplication

foreach($webapp in $WebApps){

$URL = $webapp.URL }

$ie = New-Object -ComObject InternetExplorer.Application

$ie.Navigate($URL)

while ($ie.busy -eq $true) {

Start-Sleep -Milliseconds 600 }

$ie.Visible = $true

 

Can anyone help me know where I am making the mistake ?