ExchangeShell命令

发邮件记录-----

成都创新互联公司专注于企业成都全网营销推广、网站重做改版、方正网站定制设计、自适应品牌网站建设、H5高端网站建设商城系统网站开发、集团公司官网建设、外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为方正等各大城市提供网站开发制作服务。

Get-TransportServer | Get-MessageTrackingLog -Sender:chengcheng1.tan@sk.com -EventId send -Start "2017-08-07 08:38" -End "2017-08-07 08:45" | Select-Object Timestamp,ClientIp,ClientHostname,ServerIp,ServerHostname,connectorid,Source,EventId,{$.recipients},{$.RecipientStatus},TotalBytes,RecipientCount,MessageSubject,Sender | Export-Csv -Path d:\exlog_sender_2017011301.csv -Encoding Unicode -NoTypeInformation
收邮件记录------

Get-TransportServer | Get-MessageTrackingLog -Recipients:yanyan.wang@sk.com -EventId send -Start 2016-12-01 | Select-Object Timestamp,ClientIp,ClientHostname,ServerIp,ServerHostname,connectorid,Source,EventId,{$.recipients},{$.RecipientStatus},TotalBytes,RecipientCount,MessageSubject,Sender | Export-Csv -Path d:\exlog_recipients_2017011301.csv -Encoding Unicode -NoTypeInformation

Get-Mailbox -Identity "590031i" | Ft Alias, Database
ExChange Shell API文档
https://docs.microsoft.com/en-us/powershell/module/exchange/mailbox-databases-and-servers/get-mailboxdatabase?view=exchange-ps
查看服务器集群的名字及版本信息
Get-ExchangeServer | Ft Name, ServerRole, Edition, AdminDisplayVersion -auto
获取DB列表及所在服务器信息
Get-MailboxDatabase | Format-List
查询MBX03_New DB所在的服务器信息
Get-MailboxDatabase -Identity MBX03_New | Format-List
查看某用户使用邮箱大小及所在DB情况
Get-Mailbox -Identity 590031I@sk.com | Get-MailboxStatistics | select DisplayName,TotalItemSize,Database
查询队列使用情况
Get-Queue

查看邮箱使用容量

get-mailboxstatistics -identity 590031i | format-list

get-mailboxstatistics -identity 590031i | ft displayname,totalitemsize,lastlogontime
查看ExchangeServer版本

Get-exchangeserver | format-list name,edition,admindisplayversion

删除某用户某时间段内邮件内容

Search-Mailbox -Identity "shilian.wu@sk.com" -SearchQuery "Received:01/01/2017..07/20/2017" -DeleteContent

1,按邮件主题删除特定用户特定邮件:
以下示例为删除用户sky里的邮件主题含有'Product Discussion'关键字的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "Subject:'Product Discussion'" -DeleteContent

2,按发信人地址删除特定用户特定邮件: 
以下示例为删除用户sky里的发信人为'sharepoint@pugster.com'的邮件。
br/> 
以下示例为删除用户sky里的发信人为'sharepoint@pugster.com'的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com'" -DeleteContent
删除来自某一邮箱的某一时间段的邮件;
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com' and Received:01/01/2001..11/01/2011" -DeleteContent

按内容关键字删除特定用户特定邮件:
 
以下示例为删除用户sky里的邮件内容里含有为Modify my alert settings的邮件。(因为sharepoint里更换发信人只是最近一个月的事,以前的sharepoint邮件要进行更仔细的甄别。)
 
Search-Mailbox -Identity "sky" -SearchQuery "body:'Modify my alert settings'" -DeleteContent
  검색된 메일을 삭제 (from 값이 jie.feng@sk.com인 메일)
-       Get-Mailbox -Resultsize Unlimited | Search-Mailbox -SearchQuery 'from:"jie.feng@sk.com"' -DeleteContent
1.     메일 삭제 전 사용자 조회(电子邮件删除前用户查询)
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"离职感言"' -EstimateResultOnly | Measure-Object
 
2.     메일 삭제(删除邮件)
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery ' Subject:"离职感言"' -DeleteContent 
 
3.     삭제 후 사용자 조회 (删除后用户查询)

Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery ' Subject:"离职感言"' -EstimateResultOnly | Measure-Object


网站题目:ExchangeShell命令
网页链接:http://myzitong.com/article/gesjdo.html