I have just Migrated our SharePoint to O365 2013 and all the permissions seem to be messing up. I need to reset all the permissions to inherit from its parent. I have tried this script to no prevail.
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
#Variable for Web URL
$WebURL ="https://Bytescloud.sharepoint.com/"
#get Web object
$Web = Get-SPWeb $WebURL
#Get Lists with Unique permissions - Exclude Hidden lists
$ListColl = $web.lists | Where-Object { ($_.hidden -eq $false) }
#Enumerate through each list and reset permission inheritance
foreach($list in $ListColl)
{
#Reset list inheritance
$list.ResetRoleInheritance()
Write-host "Broken Inheritance Reset on List:" $list.Title
$items = $list.Items | Where-Object{$_.HasUniqueRoleAssignments};
foreach($item in $items)
{
#Reset broken list item inheritance
$item.ResetRoleInheritance()
Write-host "Broken Inheritance Reset on List Item:" $item.URL
}
#}
$folders = $list.Folders
if ($folders.Count -gt 0)
{
foreach ($folder in $folders)
{
if ($folder.HasUniqueRoleAssignments -eq $True)
{
$folder.ResetRoleInheritance()
$folder.update()
}
}
}
}
Any help?