简体   繁体   English

如何获取用户有权访问Exchange2010的所有共享邮箱的列表| 是Exchange命令行管理程序还是PowerShell?

[英]How to get a list of all the Shared Mailboxes that a user have access to Exchange2010 | Exchange Management Shell or PowerShell?

Get-Mailbox | 获取邮箱| Get-MailboxPermission -user Get-MailboxPermission-用户

Get-Mailbox | 获取邮箱| Get-MailboxPermission -user | Get-MailboxPermission-用户| Where {$_.AccessRights -like " send as*"} 其中{$ _。AccessRights-类似的“ 发送为*”}

Get-Mailbox | 获取邮箱| Get-ADPermission | Get-ADPermission | Where {$_.extendedRights -like " send-as "} 其中{$ _。extendedRights式的“ 发送为 ”}

All of the above commands does not work for me 以上所有命令均不适用于我

I would do something like this. 我会做这样的事情。 It will output all shared mailboxes and the users that have access to it. 它将输出所有共享邮箱和有权访问它的用户。 For each user it displays the accessrights to the mailbox. 对于每个用户,它显示对邮箱的访问权限。 Depending on the number of users and shared mailboxes, it might take a while to process. 根据用户和共享邮箱的数量,可能需要一段时间才能处理。

(Because of the [ordered] , you need Powershell version 3 or better. To use it in Powershell 2, remove the [ordered] . The order in wich the properties will be displayed is not guaranteed then.) (由于[ordered] ,您需要Powershell版本3或更高版本。要在Powershell 2中使用它,请删除[ordered] 。然后将不保证显示属性的顺序。)

function Get-AllMailboxPermissions {
    $allMailboxes = Get-Mailbox -ResultSize Unlimited | Sort-Object Identity

    if ($allMailboxes.Count -eq 0) {
        Write-Warning "No mailboxes found."
        return
    }
    foreach ($box in $allMailboxes) {
        $perms = $box | Get-MailboxPermission |
                        Where-Object { $_.IsInherited -eq $false -and $_.User.ToString() -ne "NT AUTHORITY\SELF" -and $_.User.ToString() -notmatch '^S-1-' } |
                        Sort-Object User

        foreach ($prm in $perms) {
            $user = Get-Recipient -Identity $($prm.User.ToString()) -ErrorAction SilentlyContinue
            # skip inactive (deleted) users
            if ($user -and $user.DisplayName) { 
                $props = [ordered]@{
                    "Mailbox"      = "$($box.Identity)"
                    "User"         = $user.DisplayName
                    "AccessRights" = "$($prm.AccessRights -join ', ')"
                }
                New-Object PsObject -Property $props
            }
        }
    }
}

You would probably want to save this information in a csv file. 您可能希望将此信息保存在一个csv文件中。 In that case call the function like this: 在这种情况下,请调用以下函数:

Get-AllMailboxPermissions | Export-Csv -Path '<PATH-TO-OUTPUT.CSV>' -NoTypeInformation -Encoding UTF8 -Force

Tip: If you want to be able to open the csv in Excel by double-clicking it on the same machine, the Export-Csv cmdlet has a very useful switch -UseCulture . 提示:如果希望能够通过在同一台计算机上双击来在Excel中打开csv,则Export-Csv cmdlet具有一个非常有用的开关-UseCulture With this, the delimiter in the csv file will be the same Excel expects. 这样,csv文件中的定界符将与Excel期望的相同。

I finally got it working with this script below, Run this script in Microsoft Exchange Management Shell make sure that execution policy is all granted before running the script in Management Shell 我终于在下面的脚本中使用了它,在Microsoft Exchange命令行管理程序中运行此脚本,请确保在运行命令行管理程序中的脚本之前已全部授予执行策略

User with full access on User Mailboxes and Shared Mailboxes 具有“用户邮箱”和“共享邮箱”的完全访问权限的用户

Get-Mailbox | 获取邮箱| Get-MailboxPermission -user $user | Get-MailboxPermission -user $ user | Where {($ .AccessRights -eq "FullAccess") -and -not ($ .User -eq "NT AUTHORITY\\SELF")} | 其中{($ .AccessRights -eq“ FullAccess”)-和 -not ($ .User -eq“ NT AUTHORITY \\ SELF”)} | Format-Table Identity,User 格式表身份,用户

User with Send As access 具有“代理发送”访问权限的用户

Get-Mailbox | 获取邮箱| Get-ADPermission -user $user | Get-ADPermission -user $ user | Where {($ .ExtendedRights -eq "*send-as*") -and -not ($ .User -eq "NT AUTHORITY\\SELF")} | 其中{($ .ExtendedRights -eq“ * send-as *”)-和 -not ($ .User -eq“ NT AUTHORITY \\ SELF”)} | Format-Table Identity,User 格式表身份,用户

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Exchange命令行管理程序删除共享邮箱上所有禁用用户的完全访问权限 - Remove full access permissions of all disabled users on shared mailboxes with exchange management shell 每个用户的 powershell 交换共享邮箱 - powershell exchange shared mailboxes per user 列出用户在Exchange 2013中有权访问的所有邮箱? - List all mailboxes a user has access to in Exchange 2013? Powershell-导出非活动邮箱Exchange 2010 - Powershell - Export inactive mailboxes Exchange 2010 Exchange Powershell尝试收集已发送为已授予权限的所有邮箱 - Exchange Powershell attempting to gather all mailboxes that have send as permissions granted 在线交换我可以得到所有邮箱的列表吗 - Exchange online can I get a list of all mailboxes 为什么相同的脚本在 Exchange Management Shell 2010 中有效,但不能通过 C# 与 Powershell 和 Exchange Connection - Why does the same script work in Exchange Management Shell 2010 but not through C# with Powershell and Exchange Connection 更正PowerShell脚本以显示具有Exchange邮箱的禁用AD用户帐户(非共享邮箱)及其大小(以兆字节为单位)吗? - Correcting PowerShell script to show Disabled AD user account (not shared mailboxes) with Exchange mailbox and its size in MBytes? 所有已筛选用户对所有邮箱的权限-Exchange 2010 - Permissions for all filtered users to all mailboxes - Exchange 2010 Exchange命令行管理程序 - Exchange 2010 - 使用DateRange导出到PST,忽略过滤 - Exchange Management Shell - Exchange 2010 - Exporting with DateRange to PST ignoring the filtering
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM