[玩转系统] 如何导出完全访问邮箱权限
作者:精品下载站 日期:2024-12-14 05:50:19 浏览:16 分类:玩电脑
如何导出完全访问邮箱权限
您可以导出对许可的 Microsoft 365 邮箱具有完全访问权限的用户列表。通过这种方式,您可以查看哪些用户可以打开 Microsoft 365 邮箱并充当邮箱所有者。在本文中,您将了解如何使用 Exchange Online PowerShell 导出完全访问邮箱权限。
连接到 Exchange Online PowerShell
为了能够运行 PowerShell 命令,您必须连接到 Exchange Online PowerShell。以管理员身份打开 Windows PowerShell,运行以下 cmdlet,然后使用管理员凭据登录。
Connect-ExchangeOnline
导出单个用户的完全访问邮箱权限
我们将向您展示如何使用 PowerShell 导出用户邮箱的邮箱权限。
我们想要获取有关其他用户对特定用户邮箱拥有的邮箱权限的信息。我们用于显示邮箱权限的 PowerShell cmdlet 是 Get-MailboxPermission。
在我们的示例中,我们希望显示哪些用户(或组)对 Brenda 的邮箱具有完全访问邮箱权限。
我们将使用-AutoSize参数来减少结果列之间的空间。
运行以下 PowerShell 命令。
Get-MailboxPermission "[email protected]" | ft -AutoSize
查看PowerShell输出结果。
Identity User AccessRights IsInherited Deny
-------- ---- ------------ ----------- ----
0f38d53f-cbe0-4844-86e9-1032a45ba31b NT AUTHORITY\SELF {FullAccess, ReadPermission} False False
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess} False False
0f38d53f-cbe0-4844-86e9-1032a45ba31b Finance UK mail list {FullAccess} False False
0f38d53f-cbe0-4844-86e9-1032a45ba31b Sales Norway {FullAccess} False False
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess} False False
输出显示您提供的邮箱(Brenda)的身份,并在用户列下列出具有完全访问权限的邮箱。
从技术上讲,我们得到了所需的结果,但如果我们更深入地研究数据,就会发现一些问题。
当我们使用基本的PowerShell命令在Exchange Online中显示邮箱权限时,会出现很多不相关的信息。首先,我们要删除每个用户对其邮箱拥有的 SELF 权限。然后,我们要从显示的结果中删除 IsInherited 权限。
为了清除不必要的信息,我们将使用逻辑条件(Where)来排除分类为NT AUTHORITY\SELF和IsInherited完全访问邮箱权限强>。
运行以下 PowerShell 命令示例。
Get-MailboxPermission "[email protected]" | Where { ($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF") } | Ft Identity, User, AccessRights -AutoSize
PowerShell输出结果如下所示。
Identity User AccessRights
-------- ---- ------------
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b Finance UK mail list {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b Sales Norway {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess}
我们可以看到,我们成功地排除或清除了大部分不相关的信息。它显示对 Brenda 邮箱具有完全访问邮箱权限的邮箱。
导出多个用户的完全访问邮箱权限
您还可以获取多个用户的邮箱权限。在我们的示例中,我们想知道谁拥有 Brenda Smith 和 Ken Walker 的邮箱权限。
在PowerShell命令中,我们可以添加用逗号分隔的每个用户名。
请参阅下面的 PowerShell 命令语法。
"[email protected]","[email protected]" | ForEach {Get-MailboxPermission -Identity $_}
为了删除输出中的不相关信息,我们将更改上面的 PowerShell 命令。
运行 PowerShell 命令示例。
"[email protected]","[email protected]" | ForEach { Get-MailboxPermission -Identity $_ | Where { ($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF") -and -not ($_.User -like '*Discovery Management*') } } | Select Identity, User, AccessRights
PowerShell输出结果如下所示。
Identity User AccessRights
-------- ---- ------------
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b Finance UK mail list {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b Sales Norway {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] {FullAccess}
12eefbb2-e5f4-4eec-bd18-df7ca2f1ee6b [email protected] {FullAccess}
12eefbb2-e5f4-4eec-bd18-df7ca2f1ee6b [email protected] {FullAccess}
它将在您提供的邮箱(Brenda Smith & Ken Walker)的用户列下列出具有完全访问权限的所有邮箱。
导出完全访问权限用户有权访问
我们想要导出特定用户有权访问其他用户或组的完全访问邮箱权限。
要获取该信息,我们需要使用 Get-Mailbox cmdlet 来获取所有现有邮箱的列表。然后,我们还将使用 Get-MailboxPermission cmdlet 并添加用户名。
PowerShell 命令将检查所有邮箱阵列,检查用户具有邮箱权限的邮箱,并显示结果。 PowerShell 命令的其余部分用于改进 Get-MailboxPermission cmdlet 显示的结果。
在我们的示例中,我们希望获取有关用户 Brenda Smith 对其他邮箱的完全访问权限的信息。
- 在第 1 行中指定邮箱
- 运行以下 PowerShell 命令脚本
Get-Mailbox -Resultsize Unlimited | Get-MailboxPermission -User "[email protected]" | ForEach-Object {
$mailbox = Get-Mailbox $_.Identity
$User = Get-Mailbox $_.User
[PSCustomObject]@{
UserId = $User.Identity
User = $_.User
Identity = $_.Identity
UserPrincipalName = $mailbox.UserPrincipalName
AccessRights = $_.AccessRights
}
} | Format-Table UserId, User, Identity, UserPrincipalName, AccessRights
PowerShell 输出显示 Brenda Smith 拥有完全访问权限的邮箱列表。
UserId User Identity UserPrincipalName AccessRights
------ ---- -------- ----------------- ------------
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] 82cd0d62-e974-4892-aca6-e0387abc62be [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] Catch All [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] Info Box [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] 12eefbb2-e5f4-4eec-bd18-df7ca2f1ee6b [email protected]… {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] Projector 21 Projector21@a-d.… {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] RoomTest8 [email protected] {FullAccess}
0f38d53f-cbe0-4844-86e9-1032a45ba31b [email protected] c32b2b27-d809-439a-a3e3-eb7a749eeb72 Stephen.Hunter@m365in… {FullAccess}
您指定的具有完全访问权限的邮箱信息([email protected])列在UserId 和User 列下。它在身份和UserPrincipalName列下显示所有 Exchange Online 邮箱的列表。
将具有完全访问权限的邮箱列表导出到 CSV 文件
我们希望将具有完全访问邮箱权限的所有用户列表导出到 CSV 文件和 Out-GridView。它显示对另一个许可邮箱具有完全访问邮箱权限的每个邮箱。
请按照以下步骤将邮箱权限列表导出到 CSV:
- 创建 temp 文件夹并将其保存在 (C:) 驱动器(如果您还没有)
- 在第 第 2 行 中输入 CSVPath
- 运行以下 PowerShell 脚本
# Set the path for the CSV file to store the permissions
$CSVPath = "C:\temp\FullAccessPerms.csv"
try {
# Get all the mailboxes with unlimited result size and retrieve their mailbox permissions
$permissions = Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | Where-Object {
# Filter out permissions that are inherited, belong to "NT AUTHORITY\SELF", or belong to "Discovery Management"
($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF") -and -not ($_.User -like '*Discovery Management*')
} | ForEach-Object {
# For each permission, get the mailbox details
$mailbox = Get-Mailbox $_.Identity
[PSCustomObject]@{
UserPrincipalName = $mailbox.UserPrincipalName
Identity = $mailbox.Identity
User = $_.User
AccessRights = $_.AccessRights
RecipientTypeDetails = $mailbox.RecipientTypeDetails
}
} | Select-Object Identity, UserPrincipalName, User, AccessRights, RecipientTypeDetails
# Display the permissions in Out-GridView
$permissions | Out-GridView -Title "Full Access mailbox permissions"
# Export the permissions to a CSV file
$permissions | Export-Csv -Path $CSVPath -NoTypeInformation -Encoding UTF8
# Display a success message if the export was successful
Write-Host "Exported permissions successfully to $CSVPath" -ForegroundColor Cyan
}
catch {
# Display an error message if there was an exception during the export
Write-Host "Error exporting permissions: $_" -ForegroundColor Red
}
- 运行脚本后会出现 Out-GridView
- 在 C:\temp 文件夹中查找 CSV 文件
- 使用 Microsoft Excel 等应用程序打开 CSV 文件以查看结果
就是这样!
了解更多:使用 Microsoft Graph PowerShell 导出 Azure AD 用户 »
结论
您了解了如何使用 Exchange Online PowerShell 导出完全访问邮箱权限。使用 Get-MailboxPermission PowerShell cmdlet,您可以获取对单个或所有 Microsoft 365 邮箱具有完全访问权限的用户列表。
您喜欢这篇文章吗?您可能还喜欢使用 PowerShell 将 Azure AD 组成员导出到 CSV。不要忘记关注我们并分享这篇文章。
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag