郵件塞車時的處理方法
一次刪除指定人寄信的Q,描述如下,請您參考:
1. 檔案位置:主機:SCNI-EXCH02
檔案及路徑:d:\bat\RemoveQ\RemoveQ.ps1
2. 執行描述:
指令:RemoveQ.ps1 xxx@kgi.com
黃底字請輸入指定的 email address。
下圖範例是刪除 ex1601@kgi.com 寄的 Q信,[安全性警告,請按 “R” 繼續執行]。
1.在Queue中刪除特定人寄的信,語法如下:
Remove-Message -Server SCNI-EXCH01 -Filter "FromAddress -eq 'yuan@bqse-ultrapro.localdomain'" -WithNDR $false
2.關閉ArchiveMail@kgi.com 郵件日誌,刪除郵件規則。
對第五台Server查詢Email
Get-MessageTrackingLog -Sender "fund.kgbcap@kgi.com" -Start "2020/11/17 09:00" -End "2020/11/17 13:00" -Server SCNI-EXCH05
Get-TransportService
| Get-MessageTrackingLog -Recipients "tedlai@hqex.kgi.com"
-Start "2020/4/28 11:00" -End "2020/4/28 12:00"
-MessageSubject "【謹提醒】為配合政府防疫管控,五一連假期間,請避免至人多密集之公共場所及景點。" | ft Timestamp,source,
Sender,Recipients,MessageSubject,EventId
Get-TransportService | Get-MessageTrackingLog -Recipients "tedlai@hqex.kgi.com" -Start "2020/4/28 11:00" -End "2020/4/28 12:00" -MessageSubject "【謹提醒】為配合政府防疫管控,五一連假期間,請避免至人多密集之公共場所及景點。" | ft Timestamp,EventId,RecipientStatus, Sender,Recipients,MessageSubject
林隆達提供指令
[PS] C:\>get-exchangeserver | Get-MessageTrackingLog -Sender "jason.wang@kgi.com" -Recipients "laurence.lo@gie.com.tw" -Start "2020/11/22 21:00" -End "2020/11/22 23:50" | sort timestamp | ft timestamp,eventid,source,connectorid,recipientstatus,messagesubject -autosize -wrap
正在為 "Get-ExchangeServer" 命令的隱含遠端建立新的工作階段...
--------- ------- ------ ----------- --------------- ------------
2020/11/22 下午 11:21:51 RECEIVE STOREDRIVER {To, To, Cc, Cc} HK DC
2020/11/22 下午 11:21:51 HAREDIRECT SMTP {} HK DC
2020/11/22 下午 11:21:51 RECEIVE SMTP SCNI-EXCH06\Default SCNI-EXCH06 {} HK DC
2020/11/22 下午 11:21:51 HARECEIVE SMTP {} HK DC
2020/11/22 下午 11:21:51 SUBMIT STOREDRIVER {} HK DC
2020/11/22 下午 11:21:51 AGENTINFO AGENT {} HK DC
2020/11/22 下午 11:21:52 TRANSFER ROUTING {} HK DC
2020/11/22 下午 11:21:52 SENDEXTERNAL SMTP to DLP-Internet-SCNI {250 2.0.0 RCPT TO accepted} HK DC
提供查詢退信紀錄 powershell 滙出文字檔範例如下:
Get-TransportService | Get-MessageTrackingLog -Start "2020/10/22 8:00" -End "2020/10/22 10:10 " -EventId fail | fl > c:\temp\fail20201022.txt
紅字部分自行修改,範例結果如附件文字檔。
如需查詢特定email的退信紀錄 powershell 範例如下:
Get-TransportService | Get-MessageTrackingLog -Sender "aaa@kgi.com" -Recipients “bbb@kgi.com” -Start "2020/10/22 8:00" -End "2020/10/22 10:10 " -EventId fail | fl > c:\temp\fail20201022.txt
查詢ExChange 有無指定DC
[PS] C:\>Get-ExchangeServer scni-exch02 -Status | fl name,static*,current*
指定DC
[PS] C:\>Set-ExchangeServer scni-exch06 -StaticDomainControllers "scni-dc01.tw.kgi.com" -StaticGlobalCatalogs "scni-dc01.tw.kgi.com"
指定DC多個黑名單
[PS] C:\>Set-ExchangeServer scni-exch01 -StaticExcludedDomainControllers "hkdc-cdc01.hk.kgi.com,hkdc-cdc02.hk.kgi.com,hkcp-cdc01.hk.kgi.com"
指定DC後,改設定回預設值
[PS] C:\>Set-ExchangeServer scni-exch01 -Staticglobalcatalogs:$Null
[PS] C:\>Set-ExchangeServer scni-exch01 -StaticDomainControllers:$Null
[PS] C:\>Set-ExchangeServer scni-exch01 -StaticExcludedDomainControllers:$Null
[PS] C:\>Get-ExchangeServer scni-exch01 -Status | fl name,static*,current*
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {SCNI-DC01.TW.KGI.COM}
CurrentGlobalCatalogs : {SCNI-DC01.TW.KGI.COM}
CurrentConfigDomainController : SCNI-DC01.TW.KGI.COM