Using the following code, I'm able to display all entries listed under the "Application" log:
EventLog appLog = new EventLog();
appLog.Log = "Application";
appLog.MachineName = ".";
foreach (EventLogEntry entry in appLog.Entries)
{
// process
}
Since I have no FTP o RDP access to the server, is there any way to get a list of all available logs, beside "Application"? Some logs are standard but new ones can be added by users/applications.
PowerShell logs can be viewed using the Windows Event Viewer. The event log is located in the Application and Services Logs group and is named PowerShellCore .
To view the security log Open Event Viewer. In the console tree, expand Windows Logs, and then click Security. The results pane lists individual security events. If you want to see more details about a specific event, in the results pane, click the event.
If you are working only with the Application, System, and Security logs, then Get-EventLog may still work for you, but as a deprecated API there's no guarantee Microsoft will continue to make Get-EventLog available in the future.
Run:
var d = EventLog.GetEventLogs();
foreach(EventLog l in d)
{
Console.WriteLine(l.LogDisplayName);
}
If you want to see all the names. They are stored in an array.
EDIT: To do work the way you have it set up use:
var d = EventLog.GetEventLogs();
foreach(EventLog l in d)
{
foreach (EventLogEntry entry in l.Entries)
{
// process
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With