设为首页 收藏本站
查看: 2034|回复: 0

[经验分享] 在Windows server 2016 RTM下用PoweShell无人值守安装配置Exchange 20...

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-28 08:46:56 | 显示全部楼层 |阅读模式
                        在Windows server 2016 RTM下用PoweShell无人值守安装配置Exchange 2016 CU3
最新的Exchange 2016 CU3 新增支持最新的Windows Server 2016 RTM,接下我们就来通过,用纯命令(PowerShell)安装和配置Exchange 的基体功能。
1.下载 Ex2016 cu3:
Exchange 2016 CU3:ExchangeServer2016-x64-cu3.isoFixes and improvements are:
  • Added: Support for Windows Server 2016.
  • KB3154387: The DFS health set is listed as “Unhealthy” in an Exchange Server 2016 environment.
  • KB316916: Data loss may occur during public folder migration to Exchange 2013, Exchange 2016, or Exchange Online.
  • KB3190887: Upgrading Exchange Server causes the server to go offline unexpectedly
Download: Cumulative Update 3 for Exchange Server 2016 (KB3152589)     
Download: Exchange Server 2016 CU3 UM Language Packs     
View: Description of Cumulative Update 3 for Exchange Server 2016     
View: Blog post of the Exchange Team about CU3 for Exchange Server 2016
2.安装 Windows Feature:
Install-WindowsFeature NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering,RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell,Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth,Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression,Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing,Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase,Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor,Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth,Web-WMI, Windows-Identity-Foundation,RSAT-ADDS

wKiom1fo6Iqgm4a0AAAr0h0t_xY774.png
3.下载并安装 Unified Communications Managed API 4.0 Runtime
Start-BitsTransfer -Source http://download.microsoft.com/do ... cmaRuntimeSetup.exe -Destination c:        empUcmaRuntimeSetup.exe
wKioL1fo6I2w4VjjAAAWNHftjXc372.png
c:        empUcmaRuntimeSetup.exe /q
wKiom1fo6I3wXDjZAAAHT6zhlEY560.png

安装 Exchange server 2016 CU3:
1)扩展 AD
.Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
wKiom1fo6I7itQecAAAuGvDiN94032.png
.Setup.exe /PrepareAD /OrganizationName:"SEN" /IAcceptExchangeServerLicenseTerms
wKioL1fo6I_jUVZfAABFNdPlHBw866.png
.Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms
wKioL1fo6I_T6S_bAAAfeJhLBt4497.png
2)安装 Ex2016 CU3:
.Setup.exe /mode:Install /role:Mailbox /InstallWindowsComponents /TargetDir:"D:ExchangeServerV15" /MdbName:"MBDB001" /DbFilePath:"D:ExchangeServerV15MailboxMBDBFileMBDB001.edb" /LogFolderPath:"D:ExchangeServerV15MailboxMBDBLog" /CustomerFeedbackEnabled:false /IAcceptExchangeServerLicenseTerms
wKiom1fo6JDAb8kQAABfqIGDuNc283.png      
. Post-Installation Tasks:
Set-ExchangeServer –Identity SEN-Ex01 –ProductKey  *******
   
1) 新增 accepted domains
New-AcceptedDomain -Name Aplusnb -DomainName aplusnb.cn -DomainType Authoritative
wKiom1fp0-zDYo1TAAAUXHtjyTA220.png
2)启用指定OU下 用户邮箱:
get-user -OrganizationalUnit "sen.hi.cn/SEN" | where-object {$_.RecipientType –eq “User”} | Enable-Mailbox | get-mailbox | select name,windowsemailaddress,database
wKioL1fp0-zj0iGDAAAfeqNSIEo442.png    
3) 新建 Email address policy
New-EmailAddressPolicy -Name Aplusnb -IncludedRecipients AllRecipients -ConditionalCompany "Aplusnb" -EnabledEmailAddressTemplates "SMTP:@aplusnb.cn"
wKioL1fp0-3yWs0aAAAbjpk03v4018.png
Update-EmailAddressPolicy -Identity Aplusnb
get-mailbox | select name,windowsemailaddress,EmailAddresses,database
wKioL1fp0-2BoSakAAArJiXWAP8810.png

4)配置 connectors
1. 发送连接: 可以使Exchange向外部Internet发送邮件。
New-SendConnector -Name "Send To Internet" -Internet -AddressSpaces "*" -DNSRoutingEnabled:$TRUE -SourceTransportServers "SEN-Ex01"
wKioL1fp0-6BnzURAAAXlYdsvwg422.png
2.配置接收连接:使Exchange 可以接收外部Internet发过来的邮件。
Get-ReceiveConnector –Server SEN-Ex01
Get-ReceiveConnector “Default SEN-Ex01” | select Identity,PermissionGroups
wKioL1fp0-7xv4VzAAAVup3hZVY355.png
Get-ReceiveConnector “Default SEN-Ex01” | Set-ReceiveConnector -PermissionGroups AnonymousUsers, ExchangeUsers, ExchangeServers, ExchangeLegacyServers
Get-ReceiveConnector
wKioL1fp0--DBnCsAAAow7ghyUk163.png

5) 配置Exchange 证书
申请证书:
$Data = New-ExchangeCertificate -FriendlyName "SEN-Ex01_Certificate" -GenerateRequest -SubjectName "c=CN, o=NOS, cn=mail.sen.hi.cn" -DomainName mail.sen.hi.cn,autodiscover.sen.hi.cn,mail.aplusnb.cn,autodiscover.aplusnb.cn,sen-ex01.sen.hi.cn,sen-ex01,localhost  -PrivateKeyExportable $true
wKiom1fp0_DhbkcRAAAeRbJt2Fo954.png
Set-Content -path "\Sen-Ex01C$SEN-Ex01CertRequest.req.txt" -Value $Data
wKioL1fp0_CxR6eTAAAgDr3dxn8988.png
打开Exch01CertRequest.req.txt 复制其内容到企业证书服务器:   
http://SEN-DC01/Certsrv 申请证书并保存到[url=]\SEN-Ex01C$SEN-Ex01certnew.cer[/url]下:
wKiom1fp0_GDdFsXAACF5TMBfrE751.png
wKioL1fp0_LQqso0AAAvvFQKAKk354.png
wKiom1fp0_PjLBqkAABQ7F5pVlA172.png
wKioL1fp0_Szq88CAACa2uMUBQk244.png
wKioL1fp0_XCLfVrAACBqkBEwXk132.png
wKiom1fp0_WRqezLAAA4FFyJW2A283.png
wKiom1fp0_aAiEA7AABdofyX2vE443.png
wKiom1fp0_eDiy_RAABSj4jyvWE377.png
导入证书并启用服务:
Import-ExchangeCertificate –Server SEN-Ex01 -FileData ([Byte[]]$(Get-Content -Path "\SEN-Ex01C$SEN-Ex01certnew.cer" -Encoding byte -ReadCount 0)) | Enable-ExchangeCertificate –Server SEN-Ex01  -Services "IIS,POP,IMAP,SMTP"
wKioL1fp0_fybaLLAAA3i2H6oJE525.png
6)配置 Outlook Anywhere
Get-OutlookAnywhere –Server SEN-Ex01 | Set-OutlookAnywhere -ExternalHostname mail.sen.hi.cn -ExternalClientsRequireSsl:$true -ExternalClientAuthenticationMethod:Basic –InternalHostName SEN-Ex01.sen.hi.cn -InternalClientsRequireSsl:$true -InternalClientAuthenticationMethod:Basic
wKiom1fp0_jT6D6oAAAekbUUBMY656.png
7)启用 MapiHttp
Set-OrganizationConfig -MapiHttpEnabled $true
8)设置Exchange web VirtualDirectory
Set-OwaVirtualDirectory -identity "owa (default web site)" -LogonFormat UserName -DefaultDomain "sen.hi.cn"

$InDomainName = "sen.hi.cn"
$ExDomainName = "aplusnb.cn"
$InHostname = "SEN-Ex01." + $InDomainName
$ExHostname = "mail." + $ExDomainName
$InOwa = "https://" + $InHostname + "/owa"
$ExOwa = "https://" + $ExHostname + "/owa"
$InEcp = "https://" + $InHostname + "/ecp"
$ExEcp = "https://" + $ExHostname + "/ecp"
$InMapi = "https://" + $InHostname + "/mapi"
$ExMapi = "https://" + $ExHostname + "/mapi"
$InPowershell = "https://" + $InHostname + "/powershell"
$ExPowershell = "https://" + $ExHostname + "/powershell"
$InActivesync = "https://" + $InHostname + "/Microsoft-Server-ActiveSync"
$ExActivesync = "https://" + $ExHostname + "/Microsoft-Server-ActiveSync"
$InOab = "https://" + $InHostname + "/OAB"
$ExOab = "https://" + $ExHostname + "/OAB"
$InEws = "https://" + $InHostname + "/EWS/Exchange.asmx"
$ExEws = "https://" + $ExHostname + "/EWS/Exchange.asmx"
wKioL1fp0_nyL3IDAACxxGLswgI401.png
Get-OwaVirtualDirectory | Set-OwaVirtualDirectory –ExternalUrl $ExOwa –InternalUrl $InOwa  -LogonFormat UserName -DefaultDomain $InDomainName
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory –ExternalUrl $ExEcp –InternalUrl $InEcp
Get-MapiVirtualDirectory | Set-MapiVirtualDirectory –ExternalUrl $ExMapi –InternalUrl $InMapi
Get-ActiveSyncVirtualDirectory | Set-ActiveSyncVirtualDirectory -ExternalUrl $ExActivesync –InternalUrl $InActivesync
Get-OABVirtualDirectory | Set-OABVirtualDirectory -ExternalUrl $ExOab -InternalUrl $InOab -RequireSSL:$true
Get-WebServicesVirtualDirectory | Set-WebServicesVirtualDirectory -ExternalUrl $ExEws -InternalUrl $InEws -BasicAuthentication:$True -Force -MRSProxyEnabled $true
Get-PowershellVirtualDirectory | Set-PowershellVirtualDirectory –ExternalUrl $ExPowershell –InternalUrl $InPowershell -BasicAuthentication:$True
wKioL1fp0_ri-BlfAADNQPcTIFQ489.png
wKioL1fp0_uyOlTFAAC7YvjGWws625.png
9)Enable Mailbox Replication Service (MRS)MRSProxy:
Get-WebServicesVirtualDirectory | fl server,mrs*
Get-WebServicesVirtualDirectory -ADPropertiesOnly | Where {$_.MRSProxyEnabled -ne $true} | Set-WebServicesVirtualDirectory -MRSProxyEnabled $true
Set-WebServicesVirtualDirectory -Identity Exch01EWS(Default Web Site) -ExternalUrl https://mail.sen.hi.cn/EWS/exchange.asmx -BasicAuthentication $true -InternalUrl https://SEN-ex01.sen.hi.cn/EWS/Exchange.asmx
wKioL1fp0_ygub7HAAA0V_PGTBI706.png

10)发布 Exchange:        
在企业防火墙上开启以下端口:     
Port 25 for SMTP     
Port 80 for HTTP     
Port 443 for HTTPS     
Port 587 for SMTP submission     
Ports 110 and 143 for POP3 and IMAP4     
Ports 993 and 995 for Secure POP3 and Secure IMAP4.
总结:
到此为止,一个具有基本功能的Exchange 服务器就安装配置好了,安装Exchange服务器是一个比较费时间的事,通过命令的方式,可以做无人值守,从而节省时间。
一个全新的安装可以按以下命令(PowerShell)安装和配置好一台Exchange:

1.安装WindowsFeature和UcmaRuntimeSetup.exe:
Install-WindowsFeature NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering,RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell,Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth,Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression,Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing,Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase,Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor,Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth,Web-WMI, Windows-Identity-Foundation,RSAT-ADDS
Start-BitsTransfer -Source http://download.microsoft.com/do ... cmaRuntimeSetup.exe -Destination c:UcmaRuntimeSetup.exe
c:UcmaRuntimeSetup.exe /q
2.扩展AD和安装 Exchange:
先切换到Exchange光盘所在位置:(如:F: )其中红色部分请替换成自己的信息:
.Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
.Setup.exe /PrepareAD /OrganizationName:"SEN" /IAcceptExchangeServerLicenseTerms
.Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms
.Setup.exe /mode:Install /role:Mailbox /InstallWindowsComponents /TargetDir:"D:ExchangeServerV15" /MdbName:"MBDB001" /DbFilePath:"D:ExchangeServerV15MailboxMBDBFileMBDB001.edb" /LogFolderPath:"D:ExchangeServerV15MailboxMBDBLog" /CustomerFeedbackEnabled:false /IAcceptExchangeServerLicenseTerms
3.安装完成后打开Exchange Management Shell配置Exchange:
Set-ExchangeServer –Identity SEN-Ex01 -ProductKey QXYKC-7H87P-YKC2Q-XRVQ7-GTJP2
New-AcceptedDomain -Name Aplusnb -DomainName aplusnb.cn -DomainType Authoritative
get-user -OrganizationalUnit "sen.hi.cn/SEN" | where-object {$_.RecipientType –eq “User”} | Enable-Mailbox | get-mailbox | select name,windowsemailaddress,database
New-EmailAddressPolicy -Name Aplusnb -IncludedRecipients AllRecipients -ConditionalCompany "Aplusnb" -EnabledEmailAddressTemplates "SMTP:@aplusnb.cn"
Update-EmailAddressPolicy -Identity Aplusnb
get-mailbox | select name,windowsemailaddress,EmailAddresses,database
New-SendConnector -Name "Send To Internet" -Internet -AddressSpaces "*" -DNSRoutingEnabled:$TRUE –SourceTransportServers  "SEN-Ex01"
Get-ReceiveConnector  “Default SEN-Ex01” | Set-ReceiveConnector -PermissionGroups AnonymousUsers, ExchangeUsers, ExchangeServers, ExchangeLegacyServers

配置证书:
$Data = New-ExchangeCertificate -FriendlyName "SEN-Ex01_Certificate" -GenerateRequest -SubjectName "c=CN, o=NOS, cn=mail.sen.hi.cn" -DomainName mail.sen.hi.cn,autodiscover.sen.hi.cn,mail.aplusnb.cn,autodiscover.aplusnb.cn,sen-ex01.sen.hi.cn,sen-ex01,localhost  -PrivateKeyExportable $true
Import-ExchangeCertificate –Server SEN-Ex01 -FileData ([Byte[]]$(Get-Content -Path "\SEN-Ex01C$SEN-Ex01certnew.cer" -Encoding byte -ReadCount 0)) | Enable-ExchangeCertificate –Server SEN-Ex01  -Services "IIS,POP,IMAP,SMTP"

配置outlook Anywhere:
Get-OutlookAnywhere –Server SEN-Ex01 | Set-OutlookAnywhere -ExternalHostname mail.sen.hi.cn -ExternalClientsRequireSsl:$true -ExternalClientAuthenticationMethod:Basic –InternalHostName SEN-Ex01.sen.hi.cn -InternalClientsRequireSsl:$true -InternalClientAuthenticationMethod:Basic
Set-OrganizationConfig -MapiHttpEnabled $true

配置Web VirtualDirectory:   

$InDomainName = "sen.hi.cn"
$ExDomainName = "aplusnb.cn"
$InHostname = "SEN-Ex01." + $InDomainName
$ExHostname = "mail." + $ExDomainName
$InOwa = "https://" + $InHostname + "/owa"
$ExOwa = "https://" + $ExHostname + "/owa"
$InEcp = "https://" + $InHostname + "/ecp"
$ExEcp = "https://" + $ExHostname + "/ecp"
$InMapi = "https://" + $InHostname + "/mapi"
$ExMapi = "https://" + $ExHostname + "/mapi"
$InPowershell = "https://" + $InHostname + "/powershell"
$ExPowershell = "https://" + $ExHostname + "/powershell"
$InActivesync = "https://" + $InHostname + "/Microsoft-Server-ActiveSync"
$ExActivesync = "https://" + $ExHostname + "/Microsoft-Server-ActiveSync"
$InOab = "https://" + $InHostname + "/OAB"
$ExOab = "https://" + $ExHostname + "/OAB"
$InEws = "https://" + $InHostname + "/EWS/Exchange.asmx"
$ExEws = "https://" + $ExHostname + "/EWS/Exchange.asmx"

Get-OwaVirtualDirectory | Set-OwaVirtualDirectory –ExternalUrl $ExOwa –InternalUrl $InOwa  -LogonFormat UserName -DefaultDomain $InDomainName
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory –ExternalUrl $ExEcp –InternalUrl $InEcp
Get-MapiVirtualDirectory | Set-MapiVirtualDirectory –ExternalUrl $ExMapi –InternalUrl $InMapi
Get-ActiveSyncVirtualDirectory | Set-ActiveSyncVirtualDirectory -ExternalUrl $ExActivesync –InternalUrl $InActivesync
Get-OABVirtualDirectory | Set-OABVirtualDirectory -ExternalUrl $ExOab -InternalUrl $InOab -RequireSSL:$true
Get-WebServicesVirtualDirectory | Set-WebServicesVirtualDirectory -ExternalUrl $ExEws -InternalUrl $InEws -BasicAuthentication:$True -Force -MRSProxyEnabled $true
Get-PowershellVirtualDirectory | Set-PowershellVirtualDirectory –ExternalUrl $ExPowershell –InternalUrl $InPowershell -BasicAuthentication:$True



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-278444-1-1.html 上篇帖子: 安装Exchange 2013 邮箱角色 下篇帖子: outlook附件中的excel时,提示:无法创建文件 Windows server
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表