Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing certificates and enabling services


After you've generated a certificate request and have obtained a certificate from a certificate authority, you will need to install the certificate on your server using the Import-ExchangeCertificate cmdlet . This recipe will show you how to install certificates issued from a certificate authority and how to assign services to the certificate using the Exchange Management Shell.

How to do it...

  1. Let's say that you have requested and downloaded a certificate from an Active Directory Enterprise CA and downloaded the file to the root of the C:\ drive. First, read the certificate data into a variable in the shell:

    $certificate = Get-Content -Path c:\certnew.cer `
    -Encoding Byte `
    -ReadCount 0
  2. Next, we can import the certificate and complete the pending request:

    Import-ExchangeCertificate -FileData $certificate
  3. Now that the certificate is installed, we can enable it for specific services:

    Get-ExchangeCertificate -DomainName mail.contoso.com | 
      Enable-ExchangeCertificate...