Jitesh Byahut 2/16/2014 2311

Win32_NTEventLogFile in WMI C# Asp.Net

Here we are retrieving Event Log Files details of Computer.

Use namespace System.Management

using System.Management;

 

public partial class Win_Win32_NTEventlogFile : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

ManagementObjectSearcher objevent = new ManagementObjectSearcher("select * from Win32_NTEventlogFile");

 

        foreach (ManagementObject obj in objevent.Get())

        {

            Response.Write("FileName  -  " + obj["FileName"] + "</br>");

            Response.Write("LogfileName  -  " + obj["LogfileName"] + "</br>");

            Response.Write("Name  -  " + obj["Name"] + "</br>");

            Response.Write("OverWritePolicy  -  " + obj["OverWritePolicy"] + "</br>");

            Response.Write("MaxFileSize  -  " + obj["MaxFileSize"] + "</br>");

            Response.Write("NumberOfRecords  -  " + obj["NumberOfRecords"] + "</br>");

            Response.Write("------------------------------------------</br>");

        }

    }

}

Demo

View output :

demoimage


Please give your feedback for improving this page