Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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

URL FIX

$hubUrl = "NEW_NAME_OF_WEBAPP"

$find = "OLD_NAME_OF_WEBAPP"

"Installing..."

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 
        $node.Update() 
        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

$qlweb.Dispose() 

} }

"Fixing Navigation"

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

"Installation Complete!"

share|improve this answer
    
thanks. Need to test this. –  cyberpine Oct 28 '11 at 18:00

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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