[玩转系统] 将邮箱权限导出到 CSV 文件
作者:精品下载站 日期:2024-12-14 18:16:12 浏览:15 分类:玩电脑
将邮箱权限导出到 CSV 文件
我们希望将邮箱权限导出到 Exchange Server 中的 CSV 文件。那是因为该公司正在与另一家公司合并,他们要求我们检查每个邮箱的权限。这些是邮箱和共享邮箱权限。我们可以登录Exchange管理中心并打开每个邮箱并记下用户的权限。这需要时间。如果我们可以使用一个强大的脚本来为我们完成工作怎么办?在本文中,您将了解如何将邮箱权限导出到 CSV 文件。
导出邮箱权限 PowerShell 脚本
该脚本将扫描邮箱数据库并一一检查邮箱。它将把正在执行的所有操作转储到文本文件,并将权限导出到 CSV 文件。此过程可能需要一些时间,因为这取决于 Exchange 组织的规模。在我的示例中,脚本运行需要 89 秒。它总共扫描了 38 个项目。
该脚本将检查以下内容的权限:
邮箱
通讯组
-
资源邮箱
共享邮箱
该脚本会将以下 Exchange 邮箱权限导出到 CSV 文件:
发送为
完全访问权限
代寄
导出的 CSV 文件将包含每个邮箱权限的以下信息:
显示名称
主 SMTP 地址
完全访问权限
-
发送为权限
代表发送权限
现在我们已经了解了脚本的功能,下一步是下载并设置它。之后,我们将运行脚本并检查导出的结果。
准备导出 Exchange 邮箱权限脚本
从此处(直接链接)或此处 (GitHub) 下载 Samuel F. Drey 制作的 PowerShell 脚本。如果没有提示您保存文件,请右键点击 Export-MailboxFASAPermissions.ps1,然后点击链接另存为。您应该能够保存脚本。将脚本放置在 C:\scripts 文件夹中。如果没有脚本文件夹,请创建一个。
将邮箱权限导出到 CSV 文件
登录到 Exchange Server 并以管理员身份运行 Exchange 命令行管理程序。默认 cmdlet 将导出所有邮箱的权限。这些是邮箱、通讯组、资源邮箱和共享邮箱。
更改脚本目录的路径并运行脚本。
[PS] C:\>cd scripts
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-20-22-28-
02.csv
Checking if user specified -DistributionGroupsOnly switch...
Beginning routing to dump mailbox Send As, Full Access, and Send On Behalf permissions
Getting all databases
Processing Database DB01
The full mailbox command launched is :
Get-Mailbox -resultsize unlimited -database "DB01"
Parsing 37 mailboxes...
Working on mailbox Amanda Morgan which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
Found one or more SendOnBehalf Permission ! Dumping ...
Working on mailbox Christopher Payne which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
Found one or more SendOnBehalf Permission ! Dumping ...
Working on mailbox Mary Walsh which Primary SMTP is [email protected]
No custom Send As permissions detected
No custom Full Access permissions detected
No custom SendOnBehalf permissions detected
脚本完成后,将显示 CSV 文件。
验证 CSV 文件中的权限
该脚本在导出权限后将创建两个文件。找到导出的 CSV 文件。
使用您喜欢的程序打开 CSV 文件。我使用的是微软Excel。我们可以在一个简单的视图中看到邮箱的权限。
导出选定用户的邮箱权限
如果我们想导出单个用户或多个用户的邮箱权限怎么办?如果我们运行上述 cmdlet,它将搜索整个组织,这将需要时间。我和剧本的作者谈过,他帮助更新了剧本。他确实想出了一个新的-MailboxList参数。我们将利用该参数并添加要从中导出权限的用户的名称。
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1 -MailboxList "Christopher Payne"
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-00-47-47.csv
Checking if user specified -DistributionGroupsOnly switch...
Using -MailboxList parameter, checking mailboxes from that list (1 mailboxes in the list)
Processing mailbox Christopher Payne
SUCCESS - Successfully located mailbox Christopher Payne : its primary SMTP address is : [email protected]
Working on mailbox Christopher Payne which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
Found one or more SendOnBehalf Permission ! Dumping ...
saving file in C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-00-47-47.csv
The script took 2.5061906 seconds to execute...
如果我们想导出多个用户的权限,我们需要添加用逗号分隔的用户。
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1 -MailboxList "Christopher Payne", "Emma Underwood"
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-00-48-28.csv
Checking if user specified -DistributionGroupsOnly switch...
Using -MailboxList parameter, checking mailboxes from that list (2 mailboxes in the list)
Processing mailbox Christopher Payne
SUCCESS - Successfully located mailbox Christopher Payne : its primary SMTP address is : [email protected]
Working on mailbox Christopher Payne which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
Found one or more SendOnBehalf Permission ! Dumping ...
Processing mailbox Emma Underwood
SUCCESS - Successfully located mailbox Emma Underwood : its primary SMTP address is : [email protected]
Working on mailbox Emma Underwood which Primary SMTP is [email protected]
No custom Send As permissions detected
No custom Full Access permissions detected
No custom SendOnBehalf permissions detected
saving file in C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-00-48-28.csv
The script took 4.8661493 seconds to execute...
将共享邮箱权限导出到 CSV 文件
在第一部分中,我们了解了如何导出所有邮箱的权限。在第二部分中,我们确实导出了单个用户或指定用户的权限。可以仅导出共享邮箱权限。
让我们使用 -SharedMailboxes 参数。
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1 -SharedMailboxes
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-22-12-
30.csv
Checking if user specified -DistributionGroupsOnly switch...
Beginning routing to dump mailbox Send As, Full Access, and Send On Behalf permissions
Getting all databases
Processing Database DB01
Specified Resource Mailboxes parameter ? False
Specified SharedMailboxes parameter ? True
The full mailbox command launched is :
Get-Mailbox -resultsize unlimited -database "DB01" -RecipientTypeDetails SharedMailbox
Parsing 3 mailboxes...
Working on mailbox Shared Info which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
No custom SendOnBehalf permissions detected
Working on mailbox Shared Sales which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
No custom SendOnBehalf permissions detected
Working on mailbox Shared HR which Primary SMTP is [email protected]
Found one or more SendAs Permission ! Dumping ...
Found one or more Full Access Permission ! Dumping ...
No custom SendOnBehalf permissions detected
saving file in C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-22-12-30.csv
The script took 7.904148 seconds to execute...
将资源邮箱权限导出到CSV文件
如果我们只想导出资源邮箱权限怎么办?
我们可以使用-ResourceMailboxes参数。
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1 -DistributionGroupsOnly
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-22-40-28.csv
Checking if user specified -DistributionGroupsOnly switch...
User specified the -DistribugionGroupsOnly switch. Beginning Distribution Groups SendAs / GrantSendOnBehalfTo permissions dump...
Getting all distribution Groups
Testing whether the user set the -IncludeDynamic boolean parameter to $false ($true by default)
User didn't specify the -IncludeDynamic or set -IncludeDynamic to $false - including Dynamic DLs
Working on Distribution Group Management which Primary SMTP is [email protected]
No custom Send As permissions detected
Found one or more SendOnBehalf Permission ! Dumping ...
saving file in C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-21-22-40-28.csv
The script took 2.8954808 seconds to execute...
将通讯组权限导出到 CSV 文件
最后,我们希望将通讯组权限导出到 CSV 文件。
我们可以使用-DistributionGroupsOnly参数。
[PS] C:\scripts>.\Export-MailboxFASAPermissions.ps1 -DistributionGroupsOnly
********************** Beginning execution ***********************
Testing if Exchange tools are present
CommandType Name Version Source
----------- ---- ------- ------
Function Get-Mailbox 1.0 ex01-2016.exoip.local
Exchange tools are present !
True
Exchange Tools present ! continuing to test if user specified Output file
Not Output file specified, using the script standard name C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-20-22-45-18.csv
Checking if user specified -DistributionGroupsOnly switch...
User specified the -DistribugionGroupsOnly switch. Beginning Distribution Groups SendAs / GrantSendOnBehalfTo permissions dump...
Getting all distribution Groups
Testing whether the user set the -IncludeDynamic boolean parameter to $false ($true by default)
User didn't specify the -IncludeDynamic or set -IncludeDynamic to $false - including Dynamic DLs
Working on Distribution Group Management which Primary SMTP is [email protected]
No custom Send As permissions detected
Found one or more SendOnBehalf Permission ! Dumping ...
saving file in C:\scripts\Export-MailboxFASAPermissions.ps1_2020-05-20-22-45-18.csv
The script took 2.259128 seconds to execute...
现在您已经知道如何将邮箱权限导出到 CSV 文件,您会使用该脚本吗?
结论
在本文中,您学习了如何将邮箱权限导出到 CSV 文件。这是一个很棒的脚本,如果您需要导出,我建议您使用它。下次您想要审核 Exchange 组织时,请不要忘记使用脚本检查权限。
您喜欢这篇文章吗?您可能还想阅读安装 Exchange 累积更新。不要忘记关注我们并分享这篇文章。
猜你还喜欢
- 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 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[短剧] 2025年05月31日 精选+付费短剧推荐58部
[软件合集] 25年5月31日 精选软件66个
[电影] 黄沙漫天(2025) 4K.EDRMAX.杜比全景声 / 4K杜比视界/杜比全景声
[风口福利] 短视频红利新风口!炬焰创作者平台重磅激励来袭
[韩剧] 宝物岛/宝藏岛/金银岛(2025)【全16集】【朴炯植/悬疑】
[电影] 愤怒的牦牛 (2025) 国语中字 4k
[短剧合集] 2025年05月30日 精选+付费短剧推荐56部
[软件合集] 25年5月30日 精选软件26个
[软件合集] 25年5月29日 精选软件18个
[短剧合集] 2025年05月28日 精选+付费短剧推荐38部
[剧集] [央视][笑傲江湖][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
[美图] 2W美女个美女小姐姐,饱眼福
[电视剧] [突围] [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