Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
- $allfolderlist = Get-PublicFolder -Recurse | where {$_.name -ne "IPM_SUBTREE"}
- foreach ($folder in $allfolderlist) {
- $rightslist = Get-PublicFolderClientPermission $folder.Identity | where {$_.user -notlike "svc_quest*" -and $_.user -notlike "exchange services*"}
- foreach ($rightentry in $rightslist) {
- if (($rightentry.user.UserType) -eq "Default" ) {
- write-host "default"
- Remove-PublicFolderClientPermission -Identity $folder.Identity -User "Default" -Confirm:$false
- Add-PublicFolderClientPermission -Identity $folder.Identity -User "Default" -AccessRight Author
- } elseif ($rightentry.user.UserType -eq "Anonymous") {
- write-host "Anonymous"
- Remove-PublicFolderClientPermission -Identity $folder.Identity -User "Anonymous" -Confirm:$false
- Add-PublicFolderClientPermission -Identity $folder.Identity -User "Anonymous" -AccessRight None
- } else {
- write-host "removing: $($rightentry.user)"
- Remove-PublicFolderClientPermission -Identity $folder.Identity -User $($rightentry.user) -Confirm:$false
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement