Powershell script to enable the IIS Administrative and Operational logging


The sample powershell script will help us in enabling the IIS Administrative and Operational logging

Running the Sample

Step1: Open the PSIISAdminOpsLogging.ps1 in Administrator mode from the Powershell ISE.
Step2: Then execute the powershell script from Powershell ISE

Using the Code

The following code snippet is the sample of Script that serves the above requirement

Creating an object of IIS Configuration and Administrative event logging  

New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $adminLog 
New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $operationLog

More Information

The following article will give information about Enabling IIS admin and operational logging:

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.