Relative Content

Tag Archive for .netpowershellevent-viewer

System.Diagnostics.EventLog#WriteEvent() can’t find a specific event ID

Background As described in this question, I am trying to use System.Diagnostics.EventLog#WriteEvent() as an alternative for New-WinEvent and Write-EventLog cmdlet. Problem I tried to write the following log with WriteEvent(): LogName: Application Source: Application Error Event ID: 1005 $eventLog = [System.Diagnostics.EventLog]::new(‘Application’) $eventLog.Source = ‘Application Error’ $eventLog.WriteEvent( [System.Diagnostics.EventInstance]::new(1005, 0, [System.Diagnostics.EventLogEntryType]::Error), @( ‘FilePath.exe’, # FilePath ‘Application Name’, […]

System.Diagnostics.EventLog#WriteEvent() can’t find a specific event ID

Background As described in this question, I am trying to use System.Diagnostics.EventLog#WriteEvent() as an alternative for New-WinEvent and Write-EventLog cmdlet. Problem I tried to write the following log with WriteEvent(): LogName: Application Source: Application Error Event ID: 1005 $eventLog = [System.Diagnostics.EventLog]::new(‘Application’) $eventLog.Source = ‘Application Error’ $eventLog.WriteEvent( [System.Diagnostics.EventInstance]::new(1005, 0, [System.Diagnostics.EventLogEntryType]::Error), @( ‘FilePath.exe’, # FilePath ‘Application Name’, […]

System.Diagnostics.EventLog#WriteEvent() can’t find a specific event ID

Background As described in this question, I am trying to use System.Diagnostics.EventLog#WriteEvent() as an alternative for New-WinEvent and Write-EventLog cmdlet. Problem I tried to write the following log with WriteEvent(): LogName: Application Source: Application Error Event ID: 1005 $eventLog = [System.Diagnostics.EventLog]::new(‘Application’) $eventLog.Source = ‘Application Error’ $eventLog.WriteEvent( [System.Diagnostics.EventInstance]::new(1005, 0, [System.Diagnostics.EventLogEntryType]::Error), @( ‘FilePath.exe’, # FilePath ‘Application Name’, […]

System.Diagnostics.EventLog#WriteEvent() can’t find a specific event ID

Background As described in this question, I am trying to use System.Diagnostics.EventLog#WriteEvent() as an alternative for New-WinEvent and Write-EventLog cmdlet. Problem I tried to write the following log with WriteEvent(): LogName: Application Source: Application Error Event ID: 1005 $eventLog = [System.Diagnostics.EventLog]::new(‘Application’) $eventLog.Source = ‘Application Error’ $eventLog.WriteEvent( [System.Diagnostics.EventInstance]::new(1005, 0, [System.Diagnostics.EventLogEntryType]::Error), @( ‘FilePath.exe’, # FilePath ‘Application Name’, […]