Managing IIS Log files

Note: When running above script as a Scheduled task make sure

  1. to use cscript as the command and the actually script as the argument
  2. your user has access to 'Log in as a batch Job' (set in local Security policy)
  3. the user has full control of the specific log folders
  4. the tasks should be run whether user is logged in or not. It does NOT require 'run highest privileges' It does NOT require to store password

* W2012R2 - Install PHP

Reference: https://technet.microsoft.com/en-us/library/hh994592(v=ws.11).aspx\\
  • Copy PHP folder to C:\Program files\PHP\<version>\ (make sure it includes the Wincache file in ext) add to PATH & install VC++ (x86)
  • Make sure IIS CGI enabled → IIS\Application Development\CGI
  • Configure FAST CGI as per below
  • Enable Write access to IIS_IUSERS to DATA and Conf folders
  • Lock access to data, conf, bin and inc
  • Add php “phpinfo.php” file and check all ok
<?php phpinfo(); ?>
  • Open IIS Manager, select the hostname of your computer in the Connections panel, and then double-click Handler Mappings.
  • In the Action panel/ Handler Mapping , click Add Module Mapping.
  • In Request path, type *.php.
  • From the Module menu, select FastCgiModule.
  • In the Executable box, type the full path to Php-cgi.exe, for example C:\PHP\Php-cgi.exe.
  • In Name, type a name for the module mapping, for example FastCGI.
  • Click OK.
  • Select the hostname of your computer in the Connections panel, and double-click Default Document.
  • In the Action panel, click Add. Type Index.php in the Name box, and then click OK.
  • Click Add again. Type Default.php in the Name box, and then click OK.
  • Write access to Data and Conf Folders to the local account: IIS_IUSERS
  • Also add write access to /lib/tpl and /lib/plugins/ if you want to use the Configuration Manager
  • select “IIS Request Filtering”
  • go to the “URL” tab
  • click on “Deny Sequence…” for the following folders:
  • Rename the “C:\Program Files\PHP\v7.2\php.ini-production” to “php.ini”
  • uncomment the line
    extension_dir = "ext"
  • Add the line

Below is the powershell script which Cisco CCE uses to install IIS

import-module ServerManager
Install-WindowsFeature Web-Server,Web-Net-Ext45, Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Request-Monitor,Web-Basic-Auth,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI 
  • vendors/microsoft/iis.txt
  • Last modified: 2024/02/15 11:08
  • by gerardorourke