Skip to content

Instantly share code, notes, and snippets.

@abelal83
Created January 8, 2018 10:12

Revisions

  1. abelal83 created this gist Jan 8, 2018.
    10 changes: 10 additions & 0 deletions unlock-iissection.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    $assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
    $manager = new-object Microsoft.Web.Administration.ServerManager
    # load appHost config
    $config = $manager.GetApplicationHostConfiguration()

    Write-Host "Unlocking system.webServer/handlers"
    $section = $config.GetSection('system.webServer/handlers')
    $section.OverrideMode = 'Allow'
    $manager.CommitChanges()
    Write-Host "Unlocked system.webServer/handlers"