Once an Exchange 2019 server has been configured, an SSL certificate needs to be installed. For the correct configuration of the certificate, the hostnames that are relevant for the certificate must be determined. The following script reads the hostnames from the configured URLs of the virtual directories and displays the corresponding hostnames in the Exchange Management Shell. The script does not perform any configuration and is only used to check the configuration and to help with the configuration of the certificate:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#Getting Exchange FQDNs from configured URLs#Local Server Nametry { $ExchangeServer = (Get-ExchangeServer $env:computername).name}catch {}#Autodiscovertry { $AutodiscoverFQDN = ((Get-ClientAccessService -Identity $ExchangeServer).AutoDiscoverServiceInternalUri.Host).ToLower() [array]$CertNames += $AutodiscoverFQDN}catch {}#Outlook Anywheretry { $OAExtFQDN = ((Get-OutlookAnywhere -server $ExchangeServer).ExternalHostname.Hostnamestring).ToLower() [array]$CertNames += $OAExtFQDN $OAIntFQDN = ((Get-OutlookAnywhere -server $ExchangeServer).Internalhostname.Hostnamestring).ToLower() [array]$CertNames += $OAIntFQDN}catch {}#OABtry { $OABExtFQDN = ((Get-OabVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $OABExtFQDN $OABIntFQDN = ((Get-OabVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $OABIntFQDN}catch {}#ActiveSynctry { $EASIntFQDN = ((Get-ActiveSyncVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $EASIntFQDN $EASExtFQDN = ((Get-ActiveSyncVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $EASExtFQDN}catch {}#EWStry { $EWSIntFQDN = ((Get-WebServicesVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $EWSIntFQDN $EWSExtFQDN = ((Get-WebServicesVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $EWSExtFQDN}catch {}#ECPtry { $ECPIntFQDN = ((Get-EcpVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $ECPIntFQDN $ECPExtFQDN = ((Get-EcpVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $ECPExtFQDN}catch {}#OWAtry { $OWAIntFQDN = ((Get-OwaVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $OWAIntFQDN $OWAExtFQDN = ((Get-OwaVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $OWAExtFQDN}catch {}#MAPItry { $MAPIIntFQDN = ((Get-MapiVirtualDirectory -server $ExchangeServer).Internalurl.Host).ToLower() [array]$CertNames += $MAPIIntFQDN $MAPIExtFQDN = ((Get-MapiVirtualDirectory -server $ExchangeServer).ExternalUrl.Host).ToLower() [array]$CertNames += $MAPIExtFQDN}catch {}#Make FQDNs uniquetry { $CertNames = $CertNames | select -Unique}catch {}write-host "Autodiscover Hostname: $AutodiscoverFQDN Outlook Anywhere Hostname (Internal): $OAIntFQDNOutlook Anywhere Hostname (External): $OAExtFQDNActiveSync Hostname (Internal): $EASIntFQDNActiveSync Hostname (External): $EASExtFQDNOAB Hostname (Internal): $OABIntFQDN OAB Hostname (External): $OABExtFQDNEWS Hostname (Internal): $EWSIntFQDNEWS Hostname (External): $EWSExtFQDNECP Hostname (Internal): $ECPIntFQDNECP Hostname (External): $ECPExtFQDNOWA Hostname (Internal): $OWAIntFQDNOWA Hostname (External): $OWAExtFQDNMAPI Hostname (Internal): $MAPIIntFQDNMAPI Hostname (External): $MAPIExtFQDN"write-host "SANs needed for Certificate:"$CertNameswrite-host "Use this Hostname as Common Name (CN): $OWAExtFQDN" |
The output of the script on the Exchange Management Shell then looks as follows:
The script provides the host names which must be present on the certificate as SAN (Subject Alternate Name) and CN (Common Name).
The script is also available for download here:
Here you can find an article on the basic configuration for Exchange 2019:
A detailed white paper on Exchange Server and certificates is currently in progress. This script is just a small excerpt from the new whitepaper.
