使用Powershell批量设置Exchange 2013 虚拟目录URL-阿里云开发者社区

开发者社区> 云计算> 正文
登录阅读全文

使用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



版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
云计算
使用钉钉扫一扫加入圈子
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

其他文章