Advertisement
Xology

Untitled

Mar 20th, 2023
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
  2. $allfolderlist = Get-PublicFolder -GetChildren
  3. foreach ($folder in $allfolderlist) {
  4. $rightslist = Get-PublicFolderClientPermission "\$folder" | where {$_.user -notlike "svc_quest*" -and $_.user -notlike "exchange services*"}
  5. foreach ($rightentry in $rightslist) {
  6. if (($rightentry.user.UserType) -eq "Default" ) {
  7. write-host "default"
  8. Remove-PublicFolderClientPermission -Identity "\$folder" -User "Default" -Confirm:$false
  9. Add-PublicFolderClientPermission -Identity "\$folder" -User "Default" -AccessRight Author
  10.  
  11. } elseif ($rightentry.user.UserType -eq "Anonymous") {
  12. write-host "Anonymous"
  13. Remove-PublicFolderClientPermission -Identity "\$folder" -User "Anonymous" -Confirm:$false
  14. Add-PublicFolderClientPermission -Identity "\$folder" -User "Anonymous" -AccessRight None
  15. } else {
  16. write-host "removing: $($rightentry.user)"
  17. Remove-PublicFolderClientPermission -Identity "\$folder" -User $($rightentry.user) -Confirm:$false
  18. }
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement