magritton
10/14/2015 - 12:16 PM

This script is used to edit the Quciklaunch links in multiple sub sites.

This script is used to edit the Quciklaunch links in multiple sub sites.

Add-PsSnapin Microsoft.SharePoint.PowerShell

$cnt = 1
$TopSiteUrl = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES"
$topSite = Get-SPWeb $TopSiteUrl

$quicklaunch = $topSite.Navigation.QuickLaunch | where {$_.Title -eq "(M)SDS"}

$quicklaunch.Length
foreach($item in $quicklaunch)
{
    if($cnt -gt 1){
        $item.delete()
    }
    $cnt++
}
Add-PsSnapin Microsoft.SharePoint.PowerShell

$TopSiteUrl = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/OES/Cells"
$topSite = Get-SPWeb $TopSiteUrl
foreach($s in $topSite.Webs)
{
	$cell = $s.Title.replace(" Cell","");
    $cell
    ##$url = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/SitePages/OPW%20SDS.aspx?&opcos=OES&lstId=0&Cell=$cell"
    ##$url += "&gv=" + $s.URL
	##$quicklaunch = $s.Navigation.QuickLaunch
    ##($quicklaunch | where {$_.Title -eq "(M)SDS"}).URL = $url ## | Select {$_.URL}, {$_.Title}
    ##$quicklaunch | where {$_.Title -eq "(M)SDS"} | Select {$_.URL}##, {$_.Title}
    
    
    ##$link = $quicklaunch | where {$_.Title -eq "(M)SDS"} ##| Select {$_.URL}, {$_.Title}
    ##$link.URL = $url;
    ##$link.Update()
    ##$quicklaunch.Title
    ##$quicklaunch.URL
    ##$quicklaunch
	##$quicklaunch | select -ExpandProperty Children | Select {$_.Parent.Title}, {$_.Title}
}