Merzavets

Find all Exchange mailboxes with given user rights

Jan 19th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Find all Exchange mailboxes on which user "$adUser" has "$accRights" access rights
  2. # First expression just to narrow search from 'А*' to 'Я*' (from first to last letter;
  3. #      Russian mailbox identities have names like "Алла Пугачёва" or "Яков Свердлов")
  4.  
  5. $adUser = 'domain\User'
  6. $accRights = 'FullAccess'
  7.  
  8. [int][char]'а'..[int][char]'я' | foreach { get-mailbox "$([char]$_)*" -erroraction SilentlyContinue | Get-MailboxPermission  |  where { ($_.AccessRights -contains $accRights ) -and ($_.User -like $adUser) } } | ft Identity, User, AccessRights
Add Comment
Please, Sign In to add comment