Skip to content

Instantly share code, notes, and snippets.

@vmsilvamolina
Created December 23, 2016 03:50
Show Gist options
  • Save vmsilvamolina/955a84f9bf42e57b740b09251a2b4e1e to your computer and use it in GitHub Desktop.
Save vmsilvamolina/955a84f9bf42e57b740b09251a2b4e1e to your computer and use it in GitHub Desktop.
IIS ARR OWA
#URL y nombre del servidor
$PsPath = 'MACHINE/WEBROOT/APPHOST'
$URL = "office.dominio.com"
$Server = "OWA.dominio.local"
#Farm nuevo (usando el nombre de la URL)
Add-WebConfigurationProperty -pspath $PsPath -filter "webFarms" -name "." -value @{name="$($URL)"}
Add-WebConfigurationProperty -pspath $PsPath -filter "webFarms/webFarm[@name='$($URL)']" -name "." -value @{address="$($Server)"}
#Cache
Set-WebConfigurationProperty -pspath $PsPath -filter "webFarms/webFarm[@name='$($URL)']/applicationRequestRouting/protocol/cache" -name "enabled" -value "False"
#Timeout
Set-WebConfigurationProperty -pspath $PsPath -filter "webFarms/webFarm[@name='$($URL)']/applicationRequestRouting/protocol" -name "timeout" -value "01:00:00"
#Routing Rules
Add-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules" -name "." -value @{name="ARR_"+$URL+"_loadbalance_SSL";patternSyntax='Wildcard';stopProcessing='True'}
Set-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules/rule[@name='ARR_$($URL)_loadbalance_SSL']/match" -name "url" -value "*"
Add-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules/rule[@name='ARR_$($URL)_loadbalance_SSL']/conditions" -name "." -value @{input='{HTTPS}';pattern='on'}
Add-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules/rule[@name='ARR_$($URL)_loadbalance_SSL']/conditions" -name "." -value @{input='{HTTP_HOST}';pattern=$URL.Split(".")[0]+".*"}
Set-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules/rule[@name='ARR_$($URL)_loadbalance_SSL']/action" -name "type" -value "Rewrite"
Set-WebConfigurationProperty -pspath $PsPath -filter "system.webServer/rewrite/globalRules/rule[@name='ARR_$($URL)_loadbalance_SSL']/action" -name "url" -value "https://$URL/{R:0}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment