﻿# Exchange Server 2007 如何更換已過期的憑證

上個星期公司所有人開啟 Outlook 的時候都會出現憑證過期的警告，原來是 Exchange Server 2007 上預設的憑證過期了，預設的情況下在 Exchange Server 2007 安裝時就會產生一份自簽的憑證，時間長度只有一年，所以一年到了之後就要重新申請一組憑證才能正常使用，以下是本次的筆記。

1\. 用以下指令檢查現有憑證使用狀況，你會找到已過期的憑證與其 Thumbprint 的值

```
Get-ExchangeCertificate | List
```

 ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/674bea16d4b58cbbc19d-image.png)

2\. 接著我參考 [Exchange 2007 Server 中的憑證使用](http://technet.microsoft.com/zh-tw/library/bb851505\(EXCHG.80\).aspx) 的 [建立、匯入及啟用憑證](http://technet.microsoft.com/zh-tw/library/bb851505\(EXCHG.80\).aspx#CreatingImportingandEnablingCertificates) 章節更新憑證。

\----

然而，如果你是使用 CA 來產生憑證(Certificate)，在**建立憑證要求**後 (這時已產生 \*.req 檔) 必須透過以下步驟申請新的憑證來匯入 Exchange Server 2007 的憑證存放區。

1.  開啟 IE 輸入您 CA 的線上申請網址，例如： https://servername/certsrv  
    記得要安裝 \[**Active Directory 憑證服務**\] 角色，以及 \[**憑證授權單位網頁註冊**\] 才能使用  
     ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/fb8b1cd45d5c82309c7e-image.png)
2.  選擇 \[**要求憑證**\]  
    ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/de53f73bf15e9c5f3c02-image.png)
3.  選擇 \[**進階憑證要求**\]  
    ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/5169a181a8d95f3fce30-image.png)
4.  選擇 \[**用 Base-64 編碼的 CMC 或 PKCS #10 檔案來提交憑證要求**\] 或 \[**用 Base-64 編碼的 PKCS #7 檔案提交更新要求**\]  
    ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/6653bd910992347cf985-image.png)
5.  將先前**建立憑證要求**所產生的**要求憑證檔**用記事本開啟，並將內容 \[全選\] 並 \[複製\] 內容貼入如下文字方塊內，以及在**憑證範本**選取 \[**網頁伺服器**\]，並按下 \[**提交 >**\] 按鈕。  
    ![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/b61b633287819d13b1c3-image.png)
6.  如果 \[憑證擱置\] 網頁出現，請參閱檢查擱置的憑證要求。如果 \[**憑證已發出**\] 的網頁出現，請按一下 \[**下載憑證鏈結**\]，並將檔案儲存到硬碟。![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/96477ca2ef66ec433a56-image.png)
7.  最後，用以下 Powershell 指令將憑證匯入到您的憑證存放區並啟用憑證使用。

> Import-ExchangeCertificate -Path c:\\certificates\\certnew.p7b | Enable-ExchangeCertificate -Services IIS,POP,SMTP

**相關連結**

-   [Exchange 2007 Server 中的憑證使用 :: 建立、匯入及啟用憑證](http://technet.microsoft.com/zh-tw/library/bb851505\(EXCHG.80\).aspx#CreatingImportingandEnablingCertificates)
-   [建立 TLS 的憑證或憑證要求](http://technet.microsoft.com/zh-tw/library/aa998840\(EXCHG.80\).aspx)
-   [Understanding the Self-Signed Certificate in Exchange 2007](http://technet.microsoft.com/en-us/library/bb851554\(EXCHG.80\).aspx)
-   [Exchange 2007 lessons learned - generating a certificate with a 3rd party CA](https://web.archive.org/web/20101218170411/http://msexchangeteam.com/archive/2007/02/19/435472.aspx)
