如果要保证Outlook客户端的正常连接,在Exchange 2007/2010客户端访问服务器上,需要正确设置Exchange服务的URL,以便产生正确的AutoDiscover配置信息。
在安装Exchange 2010 CAS服务器角色时,安装程序会询问该服务器在Internet上被访问时使用的FQDN名称,并且会自动使用该名称为CAS上所有的基于IIS的服务配置ExternalURL属性,这些服务包括:Outlook Web App、Exchange Control Panel、ActiveSync、Offline Address Book、Exchange Web Service、AutoDiscover等,并且在启用Outlook Anywhere功能时,会再次询问FQDN名称。因此,在 Exchange 2010中,基本上不需要专门关心这些服务的ExternalURL是否正确。这是与Exchange 2007相比很大的改进。
但是在Exchange 2010的使用过程中,依然可能遇到需要对URL进行修改的情况,此时管理员就需要手动通过Exchange Management Console及Exchange Management Shell对配置进行调整。需要依次设置AutoDiscover/OWA/ECP/OAB/WebServices/ActiveSync等。下面这个脚本可以一次性为一台Exchange Server 2010的客户端访问服务器设置这些服务器的InternalURL和ExternalURL值。
这个脚本需要3个参数:
#Begin of script file
#SetCASUrl.ps1
#Author: George Wu
#Usage: .\Set-CASUrl.ps1 -CASServer <SERVERNAME> [-ExternalFqdn <Internet Fqdn>] [-InternalNameorFqdn <NetBIOSNameOrInternalFqdn>]
#Sample:.\Set-CASUrl.ps1 -CASServer pcoeexchhtcas1 -ExternalFqdn cas.pcoe.com -InternalNameorFqdn cas
#Note:
#1.If InternalNameorFqdn is omitted, CASServer will be used
#2.If ExternalFqdn is omitted, external connection will be disabled
Param(
[string] $CASServer,# = $(throw “Usage: .\Set-CASUrl.ps1 -CASServer <SERVERNAME> [-ExternalFqdn <Internet Fqdn>] [-InternalNameorFqdn <NetBIOSNameOrInternalFqdn>]”),
[string] $ExternalFqdn = “$None”,
[string] $InternalNameorFqdn = “$None”
)
if($CASServer -eq “”)
{
$CASServer = Read-Host “Client Access Server Name”
}
if($CASServer -eq “”)
{
exit
}
if($InternalNameorFqdn -eq “”)
{
$InternalNameorFqdn = $CASServer
}
$Msg = “Script is about to change configurations on server ” + $CASServer + ” with following paramenters:”
Write-Host $Msg
$Msg = “CASServer: ” + $CASServer
Write-Host $Msg
$Msg = “ExternalFqdn: ” + $ExternalFqdn
Write-Host $Msg
$Msg = “InternalNameorFqdn: ” + $InternalNameorFqdn
Write-Host $Msg
$Msg = “Configuration of server ” + $CASServer + ” will be changed.”
Write-Warning $Msg -warningaction Inquire
$InternalBase = “https://” + $InternalNameorFqdn + “/”
$ExternalBase = “https://” + $ExternalFqdn + “/”
#
$InternalUrl = $InternalBase + “owa”
if($ExternalFqdn -eq “”)
{
Get-OWAVirtualDirectory -Server $CASServer | Set-OWAVirtualDirectory -ExternalUrl $None -InternalUrl $InternalUrl -WindowsAuthentication $true -FormsAuthentication $false
}
else
{
$ExternalUrl = $ExternalBase + “owa”
Get-OWAVirtualDirectory -Server $CASServer | Set-OWAVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl -WindowsAuthentication $false -FormsAuthentication $true
}
Get-OWAVirtualDirectory -Server $CASServer | select name,InternalUrl,ExternalUrl
#
$InternalUrl = $InternalBase + “ecp”
if($ExternalFqdn -eq “”)
{
Get-EcpVirtualDirectory -Server $CASServer | Set-EcpVirtualDirectory -ExternalUrl $None -InternalUrl $InternalUrl -WindowsAuthentication $true -FormsAuthentication $false
}
else
{
$ExternalUrl = $ExternalBase + “ecp”
Get-EcpVirtualDirectory -Server $CASServer | Set-EcpVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl
}
Get-EcpVirtualDirectory -Server $CASServer | select name,InternalUrl,ExternalUrl
#
$InternalUrl = $InternalBase + “oab”
if($ExternalFqdn -eq “”)
{
Get-OABVirtualDirectory -Server $CASServer | Set-OABVirtualDirectory -ExternalUrl $None -InternalUrl $InternalUrl
}
else
{
$ExternalUrl = $ExternalBase + “oab”
Get-OABVirtualDirectory -Server $CASServer | Set-OABVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl
}
Get-OABVirtualDirectory -Server $CASServer | select name,InternalUrl,ExternalUrl
#
$InternalUrl = $InternalBase + “ews/exchange.asmx”
if($ExternalFqdn -eq “”)
{
Get-WebServicesVirtualDirectory -Server $CASServer | Set-WebServicesVirtualDirectory -ExternalUrl $None -InternalUrl $InternalUrl
}
else
{
$ExternalUrl = $ExternalBase + “ews/exchange.asmx”
Get-WebServicesVirtualDirectory -Server $CASServer | Set-WebServicesVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl
}
Get-WebServicesVirtualDirectory -Server $CASServer | select name,InternalUrl,ExternalUrl
#
$InternalUrl = $InternalBase + “Microsoft-Server-ActiveSync”
if($ExternalFqdn -eq “”)
{
Get-ActiveSyncVirtualDirectory -Server $CASServer | Set-ActiveSyncVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl
}
else
{
$ExternalUrl = $ExternalBase + “Microsoft-Server-ActiveSync”
Get-ActiveSyncVirtualDirectory -Server $CASServer | Set-ActiveSyncVirtualDirectory -ExternalUrl $ExternalUrl -InternalUrl $InternalUrl
}
Get-ActiveSyncVirtualDirectory -Server $CASServer | select name,InternalUrl,ExternalUrl
#
$InternalUrl = $InternalBase + “autodiscover/autodiscover.xml”
Set-ClientAccessServer $CASServer -AutodiscoverServiceInternalUri $InternalUrl
Get-ClientAccessServer $CASServer | select AutodiscoverServiceInternalUri
#
$ServerStatus = Get-ClientAccessServer $CASServer
if($ExternalFqdn -eq “”)
{
if($ServerStatus.OutlookAnywhereEnabled -eq $true)
{
Disable-OutlookAnywhere -Server $CASServer -Confirm
}
}
else
{
if($ServerStatus.OutlookAnywhereEnabled -eq $false)
{
Enable-OutlookAnywhere -Server $CASServer -ExternalHostname $ExternalFqdn -DefaultAuthenticationMethod ‘Basic’ -SSLOffloading $false -Confirm
}
}
Write-Warning “Attempting to restart IIS service on CAS server remotely… …”
.\psexec.exe \\$CASServer iisreset
#end of script file
其中的psexec.exe 是System Internal公司提供的一个程序,可以远程运行指定的程序。这个脚本里利用该程序到远程客户端访问服务器上进行IISRESET工作。如果不使用这个程序,可以登录到客户端访问服务器上,手动运行IISRESET。
psexec.exe可以从以下位置下载:
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
Latest posts by Exchange中文站 (see all)
- 微软将推出卫星解决方案:可连接到 Azure 云服务 - 2020年9月17日
- Windows Terminal 1.0正式发布 - 2020年5月25日
- Azure Lighthouse 相关介绍 - 2020年3月2日
发布于:
浏览:11218 次
还没有评论