Exchange Server 2013 EMS實用命令

Exchange 實用命令收集如下:

( 注: 1、以下命令均以“管理員身份”運行         2、以下命令行中的中文名稱均以實例名稱替換 )

一、啓用郵箱:

1、批量啓用郵箱帳戶:

啓用AD中所有未啓用的用戶:

Get-User -RecipientTypeDetails User -Filter { UserPrincipalName -ne $Null } | Enable-Mailbox -Database "數據庫名稱"

啓用AD中某個組織單位下面的用戶:

Get-User -OrganizationalUnit "組織單位名稱" | Enable-Mailbox -Database "數據庫名稱"

2、指定帳戶啓用郵箱帳戶:

Enable-Mailbox -Identity 域名\用戶名 -Database "數據庫名稱"

3、獲取已經創建的郵箱:

Get-Mailbox | FL Name,RecipientTypeDetails,PrimarySmtpAddress

4、禁用郵箱:

Disable-Mailbox [email protected]

二、郵件收發速度設置:

1、獲取各連接器的郵件收發速度:

Get-ReceiveConnector | ft Name,MessageRateLimit

2、設置每分鐘郵件收發速度:

Get-ReceiveConnector "服務器名稱\連接器名稱" | Set-ReceiveConnector -MessageRateLimit 100

(此處設置每分鐘發100封郵件)

三、郵件操作:

前提條件:http://blog.csdn.net/xiezuoyong/article/details/9792277

1、刪除用戶郵箱中所有的郵件內容

提升對指定數據庫中的所有用戶的操作權限:

get-mailbox -Database "數據庫名" | add-mailboxpermission -user 域名\administrator -Acce***ights FullAccess -InheritanceType all

單個刪除命令:

Search-Mailbox -Identity "郵箱名" -DeleteContent

按主題包含的關鍵字刪除:

Search-Mailbox -Identity "April Stewart" -SearchQuery "Subject:'關鍵字'" -DeleteContent

批量刪除:

get-mailbox -Database "數據庫名" | Search-Mailbox -DeleteContent

2、移動郵箱用戶到另一個數據庫:

提升對指定數據庫中的所有用戶的操作權限:

get-mailbox -Database "數據庫名" | add-mailboxpermission -user 域名\administrator -Acce***ights FullAccess -InheritanceType all

移動命令:

New-MoveRequest -Identity "郵箱用戶" -TargetDatabase '數據庫名稱'

3、導出郵件到pst文件:

單個郵箱導出:

New-MailboxExportRequest -Mailbox "郵箱用戶名" -FilePath "\192.168.12.8\mail\test.pst"

單個郵箱導入:

New-MailboxImportRequest -Mailbox "郵箱用戶名" -FilePath "\192.168.12.8\mail\test.pst"

指量導出:

Get-mailbox | export-mailbox –PSTFolderPath C:\mailboxes

批量導入:

Dir C:\Mailboxes | import-mailbox –PSTFolderPath C:\mailboxes

四、郵箱配額設置:

Set-Mailbox -Identity "Joe Healy" -IssueWarningQuota 0.9gb -ProhibitSendQuota 1gb -ProhibitSendReceiveQuota 1.2gb -UseDatabaseQuotaDefaults $false

IssueWarningQuota 設置“發出警告限制”,ProhibitSendQuota 設置“禁止發送限制”,ProhibitSendReceiveQuota 設置“禁止發送和接收限制”。

獲取郵箱配額設置:

Get-Mailbox -identity "用戶名" | fl IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota

五、配置連接器:

Set-ReceiveConnector -Identity "連接器名稱" -MaxInboundConnectionPerSource unlimited

MaxInboundConnectionPerSource 參數指定這個接收連接器同時從單一 IP 位址服務的輸入連線數目上限。預設值是 20。此參數的有效輸入範圍是 1 到 10000。若要停用接收連接器上的每個來源輸入連線限制,請輸入值 unlimited。

六、獲取所有郵箱使用情況,按大小排序

Get-Mailbox | Get-Mailboxstatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount >c:\log\shmailboxes.csv

七、獲取郵箱帳戶的GUID:

1、通過用戶名找GUID:

get-mailbox -identity "用戶名" | fl name,guid

2、批量查找所有用戶的GUID:

get-mailbox | fl name,guid

八、收件人篩選:

1、啓用收件人篩選:

Set-RecipientFilterConfig -Enabled $false

2、禁用收件人篩選:

Set-RecipientFilterConfig -Enabled $false

3、驗證收件人篩選:

Get-RecipientFilterConfig | Format-List Enabled

4、啓用或禁用收件人查找:

Set-RecipientFilterConfig -RecipientValidationEnabled <$true | $false>

5、驗證收件人查找:

Get-RecipientFilterConfig | Format-List RecipientValidationEnabled

九、發件人篩選:

1、啓用發件人篩選:

Set-SenderFilterConfig -Enabled $true

2、禁用發件人篩選:

Set-SenderFilterConfig -Enabled $false

3、驗證發件人篩選:

Get-SenderFilterConfig | Format-List Enabled

4、阻止發件人和域:

Set-SenderFilterConfig -BlockedSenders [email protected],[email protected] -BlockedDomains fabrikam.com -BlockedDomainsAndSubdomains northwindtraders.com

此示例將配置發件人篩選器代理,以阻止來自 [email protected][email protected] 的郵件、來自 fabrikam.com 域的郵件以及來自 northwindtraders.com 及其所有子域的郵件。

5、要在不修改任何現有值的情況下添加或刪除條目

Set-SenderFilterConfig -BlockedSenders @{Add="[email protected]","[email protected]"} -BlockedDomains @{Remove="tailspintoys.com"} -BlockedDomainsAndSubdomains @{Add="blueyonderairlines.com"}

本示例將使用以下信息配置發件人篩選器代理:

[email protected][email protected] 添加到被阻止的現有發件人列表。

從被阻止的現有發件人域列表中刪除 tailspintoys.com。

將 blueyonderairlines.com 添加到被阻止的現有發件人域和子域列表。

6、驗證您是否已成功配置阻止發件人

Get-SenderFilterConfig | Format-List BlockedSenders,BlockedDomains,BlockedDomainsAndSubdomains

7、啓用或禁用阻止發件人爲空的郵件

Set-SenderFilterConfig -BlankSenderBlockingenabled <$true | $false>

8、驗證是否成功啓用或禁用了阻止發件人爲空的郵件

Get-SenderFilterConfig | Format-List BlankSenderBlockingEnabled

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章