Skip to content

Instantly share code, notes, and snippets.

@ecoffman
Created October 9, 2013 13:31
Show Gist options
  • Save ecoffman/6901323 to your computer and use it in GitHub Desktop.
Save ecoffman/6901323 to your computer and use it in GitHub Desktop.
How to Ignore SPSite Root
param([string]$spSiteUrl)
$spSite = Get-SPSite -Identity $spSiteUrl
if($SPSite -eq $null)
{
Write-Host "`nSPSite at '$($spSiteUrl)' is null.";
return;
}
$siteRootWeb = $spSite.RootWeb
foreach ($spWeb in $SPSite.AllWebs)
{
if ($siteRootWeb.Url -eq $spWeb.Url)
{
continue # Ignore site root!
}
Write-Host $spWeb.Url;
}
$spSite.Dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment