SHARE
TWEET

Untitled

a guest Jun 24th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ((Get-Mailbox -Filter '*')[0] | Get-Member).Name
  2.  
  3. # Results
  4. <#
  5. PS C:Scripts> ((Get-Mailbox -Filter '*')[0] | Get-Member).Name
  6. ...
  7. RoomMailboxAccountEnabled
  8. RulesQuota
  9. SamAccountName
  10. SCLDeleteEnabled
  11. ...
  12. #>
  13.  
  14. Get-Mailbox -Filter '*' | ForEach {$PSItem.SamAccountName}
  15.  
  16. # Results
  17. <#
  18.  Get-Mailbox -Filter '*' | ForEach {$PSItem.SamAccountName}
  19. Administrator
  20. ...
  21. #>
  22.      
  23. (Get-Mailbox -Filter '*' -ResultSize Unlimited).SamAccountName |
  24. ForEach{Get-MailboxPermission -Identity $PSItem} |
  25. Where-Object {
  26.     $PSItem -ne 'NT AUTHORITYSELF' -and
  27.     $PSItem.IsInherited -eq $false
  28. } | Select-Object -Property '*'
  29.  
  30. # Results
  31. <#
  32. AccessRights    : {FullAccess, ReadPermission}
  33. Deny            : False
  34. InheritanceType : All
  35. User            : NT AUTHORITYSELF
  36. Identity        : contoso.com/Users/Administrator
  37. IsInherited     : False
  38. IsValid         : True
  39. ObjectState     : Unchanged
  40.  
  41. ...
  42. #>
  43.      
  44. (Get-Mailbox -Filter '*' -ResultSize Unlimited).SamAccountName |
  45. ForEach{Get-MailboxPermission -Identity $PSItem} |
  46. Where-Object {
  47.     $PSItem -ne 'NT AUTHORITYSELF' -and
  48.     $PSItem.IsInherited -eq $false
  49. } | Select-Object -Property Identity,User,
  50. @{Name = 'SamAccountName';Expression = {(Get-ADUser -Identity $($PSitem.Identity -split '/')[-1]).SamAccountName}},
  51. @{Name = 'Access Rights';Expression = {[string]::join(', ', $PSItem.AccessRights)}}
  52.  
  53. # Results
  54. <#
  55. Identity                              User                SamAccountName   Access Rights                      
  56. --------                              ----                --------------   -------------                      
  57. contoso.com/Users/Administrator     NT AUTHORITYSELF   Administrator    FullAccess, ReadPermission          
  58. ...
  59. #>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top