PowerShell: Open SharePoint Web Applications in Internet Explorer tabs
PowerShell: Open SharePoint Web Applications in Internet Explorer tabs.
Summary
This TechNet Wiki is based on the TechNet forum post.
Requirement
Open SharePoint Web Application in IE tabs. OP tried and ended up with the below error:
Exception calling "Navigate" with "1" argument(s): "The interface is unknown. (Exception from HRESULT: 0x800706B5)"
Background
The code used by OP is:
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 |
Unfortunately we couldn't reproduce the error message. As per the code it opened up the last web application in the URL variable.
Solution
$webapps = Get-SPWebApplication $ie = New-Object -ComObject 'InternetExplorer.Application' $ie.Visible = $true foreach($webapp in $webapps) { $ie.Navigate($webapp.url , 2048) } |
**Note: We need to know the BrowserNavConstants to open URL in new tab.
**
Reference
Navigate
https://msdn.microsoft.com/en-us/library/aa752093(v=vs.85).aspx
BrowserNavConstants
https://msdn.microsoft.com/en-us/library/aa768360%28v=vs.85%29.aspx