使用Powershell批量设置Exchange 2013 虚拟目录URL

简介:

       在项目过程中会遇到需要同时设置很多台Exchange Server服务器的虚拟目录URL,图形界面设置比较麻烦。可以使用Powershell命令一下搞定。下面以设置Exchange 2013为例,其他版本的Exchange稍微修改脚本内容即可:

脚本内容如下:

1、OWA URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置   
foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-OwaVirtualDirectory -Server $servers.server | Set-OwaVirtualDirectory -InternalUrl "https://mail2010.contoso.com/owa" -ExternalUrl "https://mail2010.contoso.com/owa" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-OwaVirtualDirectory -Server $servers.server | Set-OwaVirtualDirectory -InternalUrl "https://mail2010.contoso.com/owa" -ExternalUrl "https://mail2010.contoso.com/owa"}

2、ECP URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-ecpVirtualDirectory -Server $servers.server | Set-ecpVirtualDirectory -InternalUrl "https://mail2010.contoso.com/ecp" -ExternalUrl "https://mail2010.contoso.com/ecp" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-ecpVirtualDirectory -Server $servers.server | Set-ecpVirtualDirectory -InternalUrl "https://mail2010.contoso.com/ecp" -ExternalUrl "https://mail2010.contoso.com/ecp"}

3、EWS URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置   
foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-WebServicesVirtualDirectory -Server $servers.server | Set-WebServicesVirtualDirectory -InternalUrl "https://mail2010.contoso.com/ews/exchange.asmx" -ExternalUrl "https://mail2010.contoso.com/ews/exchange.asmx" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-WebServicesVirtualDirectory -Server $servers.server | Set-WebServicesVirtualDirectory -InternalUrl "https://mail2010.contoso.com/ews/exchange.asmx" -ExternalUrl "https://mail2010.contoso.com/ews/exchange.asmx"}

4、OAB URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置   
foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-OabVirtualDirectory -Server $servers.server | Set-OabVirtualDirectory -InternalUrl "https://mail2010.contoso.com/OAB" -ExternalUrl "https://mail2010.contoso.com/OAB" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-OabVirtualDirectory -Server $servers.server | Set-OabVirtualDirectory -InternalUrl "https://mail2010.contoso.com/OAB" -ExternalUrl "https://mail2010.contoso.com/OAB"}

5、Powershell URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置   
foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-PowerShellVirtualDirectory -Server $servers.server | Set-PowerShellVirtualDirectory -InternalUrl "https://mail2010.contoso.com/Powershell" -ExternalUrl "https://mail2010.contoso.com/Powershell" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-PowerShellVirtualDirectory -Server $servers.server | Set-PowerShellVirtualDirectory -InternalUrl "https://mail2010.contoso.com/Powershell" -ExternalUrl "https://mail2010.contoso.com/Powershell"}

6、ActiveSyncVirtualDirectory   URL

检查设置是否存在问题,通过添加-whatif参数预先执行以下命令而不实际修改具体配置   
foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-ActiveSyncVirtualDirectory -Server $servers.server | Set-ActiveSyncVirtualDirectory -InternalUrl "https://mail2010.contoso.com/Microsoft-Server-ActiveSync" -ExternalUrl "https://mail2010.contoso.com/Microsoft-Server-ActiveSync" -whatif}

更改配置,运行下面命令将对服务器配置进行实际更改

foreach($servers in (Get-OwaVirtualDirectory | where{$_.owaversion -eq "Exchange2013"})){Get-ActiveSyncVirtualDirectory -Server $servers.server | Set-ActiveSyncVirtualDirectory -InternalUrl "https://mail2010.contoso.com/Microsoft-Server-ActiveSync" -ExternalUrl "https://mail2010.contoso.com/Microsoft-Server-ActiveSync"}

本文转自 jialt 51CTO博客,原文链接:http://blog.51cto.com/jialt/1767802



相关文章
|
测试技术
Cypress如何设置全局URL?
Cypress如何设置全局URL?
193 0
|
存储 Windows
在 PowerShell 中获取代理设置
【8月更文挑战第27天】
813 6
|
网络协议
【Azure 应用服务】探索在Azure上设置禁止任何人访问App Service的默认域名(Default URL)
【Azure 应用服务】探索在Azure上设置禁止任何人访问App Service的默认域名(Default URL)
206 0
【Azure API 管理】Azure API Management在设置 Policy时,如何对URL进行解码呢? 使用 HttpUtility.UrlDecode 出错
【Azure API 管理】Azure API Management在设置 Policy时,如何对URL进行解码呢? 使用 HttpUtility.UrlDecode 出错
134 0
【Azure 应用服务】使用PowerShell脚本上传文件至App Service目录  
【Azure 应用服务】使用PowerShell脚本上传文件至App Service目录  
139 0
|
网络协议 应用服务中间件 nginx
nginx 302 301 设置 url 转跳 nginx 资源重定向 nginx tcp 和 http 转发
nginx 代理后端网站,和 网站资源目录重定向到其他连接地址
551 3
|
Windows
Powershell 重新排列去重 Windows环境变量
【9月更文挑战第13天】本文介绍如何使用PowerShell对Windows环境变量进行重新排列和去重。首先通过`$env:`访问环境变量,接着使用`-split`命令分割路径,再利用`Select-Object -Unique`去除重复项。之后可根据需要对路径进行排序,最后将处理后的路径组合并更新环境变量。注意修改环境变量前应备份重要数据并了解潜在影响。
397 10
|
监控 关系型数据库 MySQL
PowerShell 脚本编写 :自动化Windows 开发工作流程
PowerShell 脚本编写 :自动化Windows 开发工作流程
509 0
|
存储 Ubuntu Linux
windows可以安装Ubuntu,ubuntu上也可以安装Powershell
powerhsell除了可以在windows上使用外,还可以在Ubuntu上部署开发环境。下面介绍Ubuntu上安装powershell的方法。
499 0
下一篇
oss云网关配置