CLOUD UNION

Exchange Server 2019 基本运维命令合集

发表时间:2025-01-08 10:56

在Exchange Server 2019的日常运维中,使用PowerShell命令是管理和配置Exchange服务器的主要方式。以下是一些常用的Exchange 2019系统运维命令合集:


### 1. **服务器状态与健康检查**

- **获取服务器状态**:

   ```powershell

   Get-ServerHealth

   ```

- **测试服务健康**:

   ```powershell

   Test-ServiceHealth

   ```

- **检查数据库状态**:

   ```powershell

   Get-MailboxDatabaseCopyStatus

   ```


### 2. **邮箱管理**

- **获取所有邮箱**:

   ```powershell

   Get-Mailbox

   ```

- **创建新邮箱**:

   ```powershell

   New-Mailbox -UserPrincipalName user@domain.com -Alias user -Database "Mailbox Database" -Name "User Name"

   ```

- **删除邮箱**:

   ```powershell

   Remove-Mailbox -Identity user@domain.com

   ```

- **设置邮箱配额**:

   ```powershell

   Set-Mailbox -Identity user@domain.com -ProhibitSendQuota 2GB -ProhibitSendReceiveQuota 2.5GB -IssueWarningQuota 1.5GB

   ```


### 3. **数据库管理**

- **获取邮箱数据库**:

   ```powershell

   Get-MailboxDatabase

   ```

- **创建新邮箱数据库**:

   ```powershell

   New-MailboxDatabase -Name "New Mailbox Database" -Server "EXCHANGE-SERVER"

   ```

- **挂载数据库**:

   ```powershell

   Mount-Database -Identity "Mailbox Database"

   ```

- **卸载数据库**:

   ```powershell

   Dismount-Database -Identity "Mailbox Database"

   ```


### 4. **邮件流管理**

- **查看邮件队列**:

   ```powershell

   Get-Queue

   ```

- **重试队列中的邮件**:

   ```powershell

   Retry-Queue -Identity "QueueID"

   ```

- **清除队列中的邮件**:

   ```powershell

   Remove-Queue -Identity "QueueID" -Confirm:$false

   ```


### 5. **客户端访问管理**

- **获取客户端访问服务器**:

   ```powershell

   Get-ClientAccessServer

   ```

- **设置Outlook Anywhere**:

   ```powershell

   Set-OutlookAnywhere -Identity "EXCHANGE-SERVER" -ExternalHostname "mail.domain.com" -ExternalClientsRequireSsl $true -InternalHostname "mail.domain.com" -InternalClientsRequireSsl $true

   ```


### 6. **传输规则管理**

- **获取传输规则**:

   ```powershell

   Get-TransportRule

   ```

- **创建新传输规则**:

   ```powershell

   New-TransportRule -Name "Block External Emails" -FromScope NotInOrganization -RejectMessageReasonText "External emails are not allowed."

   ```


### 7. **日志与监控**

- **启用邮箱审核日志**:

   ```powershell

   Set-Mailbox -Identity user@domain.com -AuditEnabled $true

   ```

- **获取邮箱审核日志**:

   ```powershell

   Search-MailboxAuditLog -Identity user@domain.com -LogonTypes Owner -ShowDetails

   ```


### 8. **备份与恢复**

- **备份邮箱数据库**:

   ```powershell

   New-MailboxDatabase -Name "BackupDB" -Server "EXCHANGE-SERVER" -EdbFilePath "C:\Backup\BackupDB.edb"

   ```

- **恢复邮箱数据库**:

   ```powershell

   Restore-MailboxDatabase -Identity "Mailbox Database" -Recovery

   ```


### 9. **证书管理**

- **获取证书**:

   ```powershell

   Get-ExchangeCertificate

   ```

- **导入证书**:

   ```powershell

   Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path "C:\path\to\certificate.pfx" -Encoding Byte -ReadCount 0))

   ```

- **启用证书**:

   ```powershell

   Enable-ExchangeCertificate -Thumbprint "ThumbprintValue" -Services "IIS,SMTP"

   ```


### 10. **更新与维护**

- **检查更新**:

   ```powershell

   Get-ExchangeServer | Get-ExchangeUpdate

   ```

- **安装更新**:

   ```powershell

   Get-ExchangeServer | Install-ExchangeUpdate

   ```


通过熟练掌握这些PowerShell命令,可以有效地管理和维护Exchange Server 2019,确保其稳定运行和高效管理。


增值电信业务许可证:ISP沪B2-20150163
CLOUD UNION
电话:+86-021-54489915   |     Email: service@intel-mail.com

     2010-2025   © 上海云盟信息科技有限公司 | 版权所有