Skip to content

Instantly share code, notes, and snippets.

@stack72
Created October 1, 2014 17:22
Show Gist options
  • Save stack72/74ef9eda8054519bb6d1 to your computer and use it in GitHub Desktop.
Save stack72/74ef9eda8054519bb6d1 to your computer and use it in GitHub Desktop.
class application_aspnet_regiis {
include 'param::powershell'
# http://stackoverflow.com/questions/9903543/how-to-check-whether-asp-net-4-0-registered-on-iis-7-5
$onlyif_command_regiis = 'if((c:\Windows\System32\inetsrv\appcmd.exe list config -section:system.webServer/isapiFilters) | where-object {$_.Contains(\"Framework\v4.0.30319\")}) { exit 1 } else { exit 0 }'
$onlyif_command_regiis_64 = 'if((c:\Windows\System32\inetsrv\appcmd.exe list config -section:system.webServer/isapiFilters) | where-object {$_.Contains(\"Framework64\v4.0.30319\")}) { exit 1 } else { exit 0 }'
exec { 'aspnet_regiis':
path => "${param::powershell::path};C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\;${::path}",
command => "${param::powershell::command} -Command \"aspnet_regiis.exe -i\"",
onlyif => "${param::powershell::command} -Command \"${onlyif_command_regiis}\"",
logoutput => true,
}
exec { 'aspnet_regiis_64':
path => "${param::powershell::path};C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\;${::path}",
command => "${param::powershell::command} -Command \"aspnet_regiis.exe -i\"",
onlyif => "${param::powershell::command} -Command \"${onlyif_command_regiis_64}\"",
logoutput => true,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment