Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created May 13, 2015 19:24
Show Gist options
  • Select an option

  • Save beckettkev/76e3e66059346218cb03 to your computer and use it in GitHub Desktop.

Select an option

Save beckettkev/76e3e66059346218cb03 to your computer and use it in GitHub Desktop.
function Break-SPWebInheritance($siteXmlFilePath) {
$xml = Select-Xml -Path $siteXmlFilePath -XPath"//SiteStructure"
$xml.Node.Web | ForEach-Object {
Write-Host "Openning web for breaking inheritance ($($_.Url))"
$web = $clientContext.Site.OpenWeb($_.Url)
$web.BreakRoleInheritance($true, $true)
$clientContext.ExecuteQuery()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment