
 October 3, 2013 10:48 by 
 Ronny
 Ronny
 
 
There are several ways to enable IIS ISAPI CGI Restrictions. Enabling this feature can be directly in IIS or using Powershell. This section will explain How can enable IIS ISAPI CGI Restrictions with Powershell. Here below is the script for Powershell.

 
Import-Module webadministration  
 
 function Is64Bit  
  {  
       [IntPtr]::Size -eq 8  
 
 }
 
  function EnableIsapiRestriction($isapiPath){  
 
  $isapiConfiguration = get-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='$isapiPath']/@allowed"  
 
 if (!$isapiConfiguration.value){  
 
 set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='$isapiPath']/@allowed" -value "True" -PSPath:IIS:\  
 
 Write-Host "Enabled ISAPI - $isapiPath " -ForegroundColor Green  
  }  
  }  
 
    function EnableDotNet40Isapi($systemArchitecture){  
 
 $frameworkPath = "$env:windir\Microsoft.NET\Framework$systemArchitecture\v4.0.30319\aspnet_isapi.dll" 
 
 EnableIsapiRestriction $frameworkPath       
  }  
 
    function Main(){  
 
 if (Is64Bit){  
 
 EnableDotNet40Isapi "64"  
 }  
 
 EnableDotNet40Isapi  
 }  
 
    Main
Now IIS ISAPI CGI Restrictions have been active. Happy programming!