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



相关文章
|
4月前
|
测试技术
Cypress如何设置全局URL?
Cypress如何设置全局URL?
|
3天前
|
网络协议 应用服务中间件 nginx
nginx 302 301 设置 url 转跳 nginx 资源重定向 nginx tcp 和 http 转发
nginx 代理后端网站,和 网站资源目录重定向到其他连接地址
38 3
宜搭详情页面URL设置
宜搭自定义详情页跳转问题
宜搭详情页面URL设置
|
8月前
|
机器人 SEO
SAP 电商云 Spartacus UI 根据 url 设置 site context 的具体例子
SAP 电商云 Spartacus UI 根据 url 设置 site context 的具体例子
55 0
|
8月前
powershell 设置代理
powershell 设置代理
183 0
|
10月前
|
前端开发 JavaScript 关系型数据库
宝塔设置PHP定时任务实战记录(定时任务、ajax异步刷新API、shell脚本、访问url)
宝塔设置PHP定时任务实战记录(定时任务、ajax异步刷新API、shell脚本、访问url)
498 0
|
4月前
|
存储 Ubuntu Linux
windows可以安装Ubuntu,ubuntu上也可以安装Powershell
powerhsell除了可以在windows上使用外,还可以在Ubuntu上部署开发环境。下面介绍Ubuntu上安装powershell的方法。
57 0
|
6月前
|
Shell Linux 开发工具
windows中cmd和PowerShell批处理命令
之前在 Git 批量删除本地分支,有用到 Linux 或 MacOS 下的批处理命令,这个命令中的 grep、xargs 本身是 Shell script,在 windows 中的 cmd 和 PowerShell 中是不能用的
53 0
|
9月前
|
JavaScript Windows
[Vue]解决 Windows PowerShell 不识别 vue 命令的问题
[Vue]解决 Windows PowerShell 不识别 vue 命令的问题
|
9月前
|
Windows
使用PowerShell获取Windows当前锁屏壁纸
使用PowerShell获取Windows当前锁屏壁纸 如果原始图片丢了,用这段代码就可以提取当前锁屏壁纸了!
103 0