How to Remove a Quick Launch Item using PowerShell

I was recently asked to remove a Quick Launch item in all quick launch menus across an entire web application.  The following PowerShell will iterate over all webs in all sites in a web application searching for the menu item labelled “BAD Quick Launch Item” and will delete that node from each location.

$FindString = “BAD Quick Launch Item”

Get-SPWebApplication “http://webapplication.company.com” | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL | ForEach-Object {
    $web = $_
    $_.Navigation.QuickLaunch | ForEach-Object {
        $_.Children | ForEach-Object {
            if($_.title -eq $FindString){
                $node = $_
                $node.delete()
                Write-Host “Deleted node from ” $web “-” $web.url
            }
        }
    }
}

Hopefully this helps anyone else in the same situation.

3 responses to “How to Remove a Quick Launch Item using PowerShell

  1. Thanx for sharing this elegant solution.

    just as a note, this solution does not look at the top most nodes.
    Top1
    – child1
    – BAD Quick Launch Item
    Top2
    – children
    BAD Quick Launch Item (Top3 will not be removed)
    -children

  2. Hi

    My requirement is to Add the View all site contents link in the top right corner using powershell/jquery (only client side)

    Paru

Comments are closed.