Skip to content

Instantly share code, notes, and snippets.

@lennybacon
Created August 7, 2014 08:47
Show Gist options
  • Save lennybacon/120103adae98da084c32 to your computer and use it in GitHub Desktop.
Save lennybacon/120103adae98da084c32 to your computer and use it in GitHub Desktop.
IIS Configuration PowerShell Script
Set-Alias iiscfg Edit-ApplicationHostsConfig
function Edit-ApplicationHostsConfig {
$file = Get-ApplicationHostsConfig
edit $file
}
function Get-ApplicationHostsConfig(){
$appHostConfig = "C:\Windows\sysnative\inetsrv\config\applicationHost.config"
$exists = Test-Path $appHostConfig
if($exists -eq $false){
$appHostConfig = "C:\Windows\system32\inetsrv\config\applicationHost.config"
}
$exists = Test-Path $appHostConfig
if($exists -eq $false){
throw "The file applicationHost.config could not be found!"
}
return $appHostConfig
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment