Powershell:获取授予用户是ADgroup成员的邮箱的邮箱权限

时间:2020-10-06 15:06:53

标签: exchange-server

Powershell:获取授予用户是AD组成员的邮箱的邮箱权限

我认为我的问题与adgroupmember中提供的用户信息和邮箱权限不匹配。 我该如何搭配?

    #####################################################################
#
# Script om mailboxpermissions van een groep op te lijsten
# Last Modified :  06/10/2020
# 
#####################################################################


$allfolders = @()

$AllUsers = Get-Mailbox -RecipientTypeDetails 'UserMailbox' -ResultSize Unlimited | sort name


$group = "Granted_ADGroup" #has this group full access to other user mailboxes
$members = Get-ADGroupMember -Identity $group -Recursive | Select -ExpandProperty samaccountName | sort
#$members

write-output "groups done"

ForEach ($User in $AllUsers)
{
$Mailbox = $User 
Write-Output $Mailbox 

$mb = @{Expression={$User.Name};Label="Mailbox"}
$add =  get-mailboxpermission $mailbox  | where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false -and $user -in $members } | select identity,user,accessrights

#$add | ft -autosize
$allfolders += $add

<# $add = Get-Mailbox $mailbox | Get-ADPermission | ? {(($_.ExtendedRights -like "*send-as*") -or ($_.AccessRights -eq "FullAccess")) -and -not ($_.User -like "nt authority\self")} | ft Identity, User, "send as right" -auto
$add | ft -autosize
$allfolders += $add #>



}

$allfolders  | Export-Csv C:\temp\GetAllMailboxPermissions.csv -NoType

0 个答案:

没有答案
相关问题