Search This Blog

Thursday, December 9, 2010

Configure CAS virtual directories

In some cases you need to define the external as internal url for your client access servers. This is the case when you use a wild card certificate. I thought of creating a script that asks for the url, and implements that url for all your virtual directories on all you client access servers.

[Code]

#TheRealShrimp.blogspot.com 8/12/2010#

Write-host "Please fill in the url you wish to use. Use the world wide web name (www.host.com)."
$url = Read-Host
#------------------------------------------------------------------------------------#
#Set the owa virtual directories#
#------------------------------------------------------------------------------------#
$Cas = get-owavirtualdirectory
Foreach ($_.Name in $Cas) {set-owavirtualdirectory $_.Name -internalurl https://"$url"/owa -externalurl https://"$url"/owa}
$Show = get-owavirtualdirectory | Select-Object Name, Internalurl, Externalurl
write-host "Following url's have been set for Outlook Web App"
Write-Host $Show
#-------------------------------------------------------------------------------------#
#Set the ActiveSync virtual directories#
#-------------------------------------------------------------------------------------#
$Active = Get-ActiveSyncVirtualDirectory
Foreach ($_.name in $Active) {Set-ActiveSyncVirtualDirectory $_.Name -internalurl https://"$url"/MicrosoSelect-Object-Server-ActiveSync -externalurl https://"$url"/MicrosoSelect-Object-Server-ActiveSync}
$Show = Get-ActiveSyncVirtualDirectory | Select-Object Name, Internalurl, Externalurl
write-host "Following url's have been set for Outlook Web App"
Write-Host $Show
#-------------------------------------------------------------------------------------#
#Set the Offline Address Book#
#-------------------------------------------------------------------------------------#
$Book = Get-OabVirtualDirectory
Foreach ($_.Name in $Book) {Set-OabVirtualDirectory $_.name -Internalurl https://"$url"/Oab -externalurl https://"$url"/Oab}
$Show = Get-OabVirtualDirectory | Select-Object Name, Internalurl, Externalurl
write-host "Following url's have been set for Outlook Web App"
Write-Host $Show
#-------------------------------------------------------------------------------------#
#Set the Exchange Control Panel#
#-------------------------------------------------------------------------------------#
$ExCoP = Get-EcpVirtualDirectory
Foreach ($_.Name in $ExCop) {Set-ecpVirtualDirectory $_.name -Internalurl https://"$url"/Ecp -externalurl https://"$url"/Ecp}
$Show = Get-EcpVirtualDirectory | Select-Object Name, Internalurl, Externalurl
write-host "Following url's have been set for Outlook Web App"
Write-Host $Show
#-------------------------------------------------------------------------------------#
#Set-Offline Address Book SCP
#-------------------------------------------------------------------------------------#
$Cas = Get-ClientAccessServer
ForEach ($_.Name in $Cas) {Set-ClientAccessServer $_.Name -AutoDiscoverServiceInternalUri https://"$Url"//Autodiscover/Autodiscover.xml}
#-------------------------------------------------------------------------------------#
[/Code]

No comments:

Post a Comment