Microsoft-Windows-Diagnostics-Performance Event Log
Bonjour,
Voici un bout de code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| private void BootTime()
{
EventLogQuery EventQuery = new EventLogQuery("Microsoft-Windows-Diagnostics-Performance/Operational",PathType.LogName);
EventQuery.ReverseDirection = true; //start with newest first
EventLogReader EventReader = new EventLogReader(EventQuery);
EventRecord EventRecord;
while ((EventRecord = EventReader.ReadEvent()) != null)
{
if (EventRecord.Id == 100 || EventRecord.Id == 101)
{
MessageBox.Show(EventRecord.LogName.ToString() + "\n" +
EventRecord.TimeCreated.ToString() + "\n" +
EventRecord.Id.ToString() + "\n" +
EventRecord.Level.ToString() + "\n" +
EventRecord.ToString() + "\n" +
EventRecord.ProcessId.ToString() + "\n");
}
} |
Voir le code suivant.
Ceci fonctionne bien, cependant je dois aller chercher d'autres informations et je n'arrive pas à comprendre comment l'obtenir. Je veux avoir toutes les propriétés dans Description. (File Name, Total Time, etc)
Soit les lignes de 12 à 17.
Merci de votre aide.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Log Name: Microsoft-Windows-Diagnostics-Performance/Operational
Source: Microsoft-Windows-Diagnostics-Performance
Date: 11-09-2010 11:26:38
Event ID: 203
Task Category: Shutdown Performance Monitoring
Level: Warning
Keywords: Event Log
User: LOCAL SERVICE
Computer: RMS-PC
Description:
This service caused a delay in the system shutdown process:
File Name : iphlpsvc
Friendly Name :
Version :
Total Time : 10606ms
Degradation Time : 6232ms
Incident Time (UTC) : 11-09-2010 05:48:17 |
J'ai trouvé la solution, j'envoie l'info ToXml() et je traite le fichier xml pour récupérer les infos.
Merci