|
转载 Get-ReceiveConnector "Internet Receive Connector" | Remove-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient"
25.去除接收匿名邮件域发送者的权限(对过滤垃圾邮件有一定作用)
Get-ReceiveConnector "Internet Receive Connector" | Remove-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-exch-smtp-accept-authoritative-domain-sender"
26.查看某一个邮箱的统计信息(最后登录时间等)
Get-MailboxStatistics -Identity 'administrator' |fl
27.查看某个邮箱服务器上所有用户的统计信息,例如在这里范例需要查看邮件服务器 tr-ex01 上相关用户的登录时间,可以输入如下内容:
Get-MailboxStatistics -server 'tr-ex01'
28.查看某个邮箱服务器上所有用户的统计信息,并且以降序排列,例如在这里范例需要查看邮件服务器 tr-ex01 上相关用户的登录时间并且以降序方式排列,可以输入如下内容:
Get-MailboxStatistics -server 'tr-ex01' | Sort LastLogonTime -Descending
29.查询一段时间的 每个用户的邮件发送数量
Get-MessageTrackingLog -ResultSize unlimited -Start"07/01/2012" -End "07/13/2012" -EventId "send"|Group-Object -Property:sender |Select name,count|sort count -Descending
如果不想要外部邮箱的话,加一个filter
Get-MessageTrackingLog -ResultSize Unlimited -Start"10/1/2013" -End "10/25/2013" | where{$_.recipients -like"*@domain.com"}
如果是要查发出的,就把recipients改成sender
30.本示例返回贵组织中所有邮箱的摘要列表
Get-Mailbox -ResultSize unlimited
31.返回组织内名为 Users 的 OU 中所有邮箱的列表
Get-Mailbox -OrganizationalUnit Users
32.查询ex 邮箱服务器 上面所有存档邮箱的列表
get-mailbox -archive -server ex
32.查询mailbox1 邮箱数据库 上面所有存档邮箱的列表
get-mailbox -archive -database mailbox1
33.查询所有的邮箱数量
(get-mailbox-resultsize unlimited).count
34.查询每个邮箱数据库中分别有多少用户
get-mailbox-resultsize unlimited | group-object -property:database | select-objectname,count
如果把database参数更替为邮箱数据库的名字,那统计出来的就是某一个邮箱数据库内的用户数量
35.查询每个邮箱服务器上面分别有多少用户
get-mailbox-resultsize unlimited | group-object -property:servername | select-object name,count
如果把 servername参数更替为服务器的名字,那统计出来的就是某一个邮箱服务器内的用户数量
36.批量导出、导入邮箱
1.赋予管理员权限
New-ManagementRoleAssignment -Name "ImportExport_Domain Admins" -User "Administrator" -Role "MailboxImport Export"
2.批量导出邮件到C盘EXPORT文件夹下
get-mailbox -OrganizationalUnit "contoso.com/contoso" -resultsize unlimited |%{New-MailboxexportRequest -mailbox $.name -FilePath ("\localhost\c$\export\"+($.name)+".pst") -BadItemLimit50}
3. 批量导入PST文件到目的邮箱地址
get-childitem\localhost\c$\export*.pst | select name,basename | %{New-MailboximportRequest-mailbox $.basename -FilePath ("\localhost\c$\export\"+$.name)-BadItemLimit 50}
37.查找用户的GUID
get-mailbox -identity "用户名" | fl name,guid
38.查找所有用户的GUID
get-mailbox | fl name,guid
39.获取邮箱使用情况,按大小排序
Get-Mailbox | Get-Mailboxstatistics | Sort-ObjectTotalItemSize -Descending | ftDisplayName,totalitemsize
40.获取某个用户的邮箱配额(警告、阻止、阻止发送接收):
Get-Mailbox -identity "用户名" | fl IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota
41.提升指定数据库中的所有用户的操作权限为administrator
get-mailbox -Database "数据库名" | add-mailboxpermission -user域名\administrator -Acce***ights FullAccess -InheritanceTypeall
42.批量启用邮箱账户
启用AD中所有未启用的用户:
Get-User -RecipientTypeDetails User -Filter { UserPrincipalName -ne $Null} | Enable-Mailbox -Database "数据库名称"
启用AD中某个组织单位下面的用户:
Get-User -OrganizationalUnit "组织单位名称" | Enable-Mailbox -Database "数据库名称"
43、查看每个账户设备的连接数量
Get-MobileDeviceStatistics -Mailbox 用户名 | fl deviceid
44.开启或关闭NDR(未送达报告)
Set-RemoteDomain contoso -NDREnabled $false
Set-RemoteDomain Contoso -NDREnabled $true
45.导入、导出邮箱
new-mailboxexportrequest -mailbox zhangsan -filepath \****\mailbox.pst
new-mailboximportrequest -mailbox zhangsan -filepath \***\mailbox.pst
导入导出路径必须为UNC路径,导出为PST格式可以直接用OUTLOOK挂载进行查看。
46.邮件跟踪命令
查看用户发送和接收邮件的记录
get-messagetrackinglog -sender zhangsan@abc.com
get-messagetrackinglog -recipients zhangsan@abc.com
查看zhangsan发往lisi的邮件记录
get-messagetrackinglog -sender zhangsan@abc.com -recipients lisi@abc.com
查看某个发送周期内的发送记录
get-messagatrackinglog -sender lisi@abc.com -recipients zhangs@abc.com -start "2017-06-01 -end "2017-07-11"
47.查看、启动EXCHANGE服务器的组件
查看组件是否正常运行:
get-servercomponentstate servername | fl component,state
活动:active 非活动:inactive
启动相应组件:
Set-ServerComponentState -identity ServerName -component ComponentName -Requester healthapi -State active
48.查看exchange服务器当前使用的DC/GC
Get-ExchangeServer -status | fl name, static,current
如果需要更改使用set-exchangeserver |
|
|