Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ((Get-Mailbox -Filter '*')[0] | Get-Member).Name
- # Results
- <#
- PS C:Scripts> ((Get-Mailbox -Filter '*')[0] | Get-Member).Name
- ...
- RoomMailboxAccountEnabled
- RulesQuota
- SamAccountName
- SCLDeleteEnabled
- ...
- #>
- Get-Mailbox -Filter '*' | ForEach {$PSItem.SamAccountName}
- # Results
- <#
- Get-Mailbox -Filter '*' | ForEach {$PSItem.SamAccountName}
- Administrator
- ...
- #>
- (Get-Mailbox -Filter '*' -ResultSize Unlimited).SamAccountName |
- ForEach{Get-MailboxPermission -Identity $PSItem} |
- Where-Object {
- $PSItem -ne 'NT AUTHORITYSELF' -and
- $PSItem.IsInherited -eq $false
- } | Select-Object -Property '*'
- # Results
- <#
- AccessRights : {FullAccess, ReadPermission}
- Deny : False
- InheritanceType : All
- User : NT AUTHORITYSELF
- Identity : contoso.com/Users/Administrator
- IsInherited : False
- IsValid : True
- ObjectState : Unchanged
- ...
- #>
- (Get-Mailbox -Filter '*' -ResultSize Unlimited).SamAccountName |
- ForEach{Get-MailboxPermission -Identity $PSItem} |
- Where-Object {
- $PSItem -ne 'NT AUTHORITYSELF' -and
- $PSItem.IsInherited -eq $false
- } | Select-Object -Property Identity,User,
- @{Name = 'SamAccountName';Expression = {(Get-ADUser -Identity $($PSitem.Identity -split '/')[-1]).SamAccountName}},
- @{Name = 'Access Rights';Expression = {[string]::join(', ', $PSItem.AccessRights)}}
- # Results
- <#
- Identity User SamAccountName Access Rights
- -------- ---- -------------- -------------
- contoso.com/Users/Administrator NT AUTHORITYSELF Administrator FullAccess, ReadPermission
- ...
- #>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement