Set Portal link for navigating above a Site Collection

Set Portal link for navigating

One of the annoyances in SharePoint is that there is no easy way for end users to navigate to outside the site collection. Creating a Portal Connection is one easy way. However configuration is manual. Here’s a way to automate this connection.

First, we get the Web Application object, then use that to iterate through all the Site Collection objects.  the -Limit All ensures we process all, otherwise it will default to the top 20.  Then we set the Portal name and link.  note that no update() is required if you use the methods below.  If you instead update the properties directly, an object update() is required.

Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
# Script changes the letter heading in each site collection - Joel Plaut
$WebApp = Get-SPWebApplication "http ://sharepoint";
$SA = $WebApp | Get-SPSite -Limit all
foreach ($MySite in $SA)
Write-Host "Fixing Portal for $($MySite.url)" -ForegroundColor darkred
$MySite.set_PortalURL("http ://sharepoint")