Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
- $allfolderlist = Get-PublicFolder -GetChildren
- foreach ($folder in $allfolderlist) {
- $rightslist = Get-PublicFolderClientPermission "\$folder" | 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" -User "Default" -Confirm:$false
- Add-PublicFolderClientPermission -Identity "\$folder" -User "Default" -AccessRight Author
- } elseif ($rightentry.user.UserType -eq "Anonymous") {
- write-host "Anonymous"
- Remove-PublicFolderClientPermission -Identity "\$folder" -User "Anonymous" -Confirm:$false
- Add-PublicFolderClientPermission -Identity "\$folder" -User "Anonymous" -AccessRight None
- } else {
- write-host "removing: $($rightentry.user)"
- Remove-PublicFolderClientPermission -Identity "\$folder" -User $($rightentry.user) -Confirm:$false
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement