Home > PowerShell, SharePoint 2010 > Get a Listing of All SharePoint 2010 Navigation Quick Launch Hyperlinks using PowerShell

Get a Listing of All SharePoint 2010 Navigation Quick Launch Hyperlinks using PowerShell

Recently I had a requirement to generate a listing of all hyperlinks on every Navigation Launch for every Site Collection to search for a specific hyperlink because there was a Site that was moved and we needed to identify if there were any hyperlinks pointing to that site and remove it.

Below is the Powershell script I used to accomplish this task.

———————————————————————————————————————————————————————————–

#URL to Web Application
$webApp = Get-SPWebApplication “http://portal”

#URL to search for
$searchURL = “*/sites/site1/*”

foreach ($web in $webApp | Get-SPSite -Limit All | Get-SPWeb -Limit All)
{

$hyperlink = $web.Navigation.QuickLaunch
“———Web:” + $web.Url >> hyperlinks.txt

foreach ($hyperlink in $hyperlinks)
{

if (hyperlink.Url -notlike “/*_layouts/*” -and hyperlink.Url -like $searchURL)
{

$hyperlinkUrl = $hyperlink.Url
“———————————Navigation Hyperlink: ” + $hyperlinkUrl >> hyperlinks.txt

}
}
}
$webApp.Dispose()

————————————————————————————————————————————————————————————

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: