Exchange Shell命令

發郵件記錄-----shell

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 -NoTypeInformationide

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-Queuecode

查看郵箱使用容量orm

get-mailboxstatistics -identity 590031i | format-listserver

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

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

刪除某用戶某時間段內郵件內容ci

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,按發信人地址刪除特定用戶特定郵件: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

相關文章
相關標籤/搜索