We migrated an SP 2007 site collection to 2010 by attaching it's DB. However, because the Host Name changed and because we had hard coded urls in the navigation we have broken tabs as expected.

Is there a simple scripted way to fix this without having to buy migration software?

Also, we imported some 17,000+ user profiles , but still while in the navigation setting page, If we attempt to add an owners group to the tab audience I get an error that it's not found, even with I find the sharepoint group through address book.

2 Answers 2


You may get some errors while running this script but you will find that its worked too :)





Add-PSSnapIn Microsoft.SharePoint.PowerShell if ([Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") -eq $null) { throw "Unable to load Microsoft.SharePoint.dll!"; }

"Upgrade visual web to v4..." $site = Get-SPSite $huburl $site.VisualUpgradeWebs() $site.Dispose()

$hubUrl = $hubUrl.TrimEnd('/'); $web = Get-SPWeb $hubUrl

function UpdateNodeCollection { param([Microsoft.SharePoint.Navigation.SPNavigationNodeCollection]$nodes) foreach ($node in $nodes) { $nodeUrl = $node.Url if ($nodeUrl.ToString().ToLower().Contains($fromURL) -or $nodeUrl.ToString().ToLower().Contains($fromURL2)) { Write-Host " found link to: " -foreground gray -nonewline; Write-Host $nodeUrl -nonewline

        ## update the link 
        $nodeUrl = $nodeUrl.ToString().ToLower().Replace($fromUrl,$toURL)
        $node.Url = $nodeUrl 
        Write-Host " – done." -foreground green
    UpdateNodeCollection $node.Children


function UpdateQuickLaunch { param([string]$fromURL, [string]$toURL)

foreach ($qlweb in (Get-SPSite $toURL | Get-SPWeb -Limit All)) { ## scan the web quick launch urls Write-Host "Scanning " $qlweb.Url $nodes = $qlweb.Navigation.QuickLaunch UpdateNodeCollection $nodes $nodes = $qlweb.Navigation.TopNavigationBar UpdateNodeCollection $nodes


} }

"Fixing Navigation"

$replace = $hubUrl + "/" UpdateQuickLaunch $find $replace

"Installation Complete!"


I have used PowerShell in the past to iterate through the navigation links and check for the old hostname/prefix and update as necessary. Unfortunately there is no simple switch to throw to mitigate the issue unless your farm is built on a DNS alias so you can just update that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.