We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I run the sample code as admin:
#test-posheventlog.ps1 Import-Module PoShLog Import-Module PoShLog.Sinks.EventLog New-Logger | Add-SinkEventLog -Source 'PoshLogs' | Start-Logger Write-InformationLog 'My message in windows event log' Close-Logger
I get this error:
PS C:\Scripts\> .\test-posheventlog.ps1 Exception calling "EventLog" with "9" argument(s): "EventLog access is not supported on this platform." At C:\Program Files\WindowsPowerShell\Modules\PoShLog.Sinks.EventLog\1.0.0\functions\sinks\Add-SinkEventLog.ps1:56 char:3 + $LoggerConfig = [Serilog.LoggerConfigurationEventLogExtension ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PlatformNotSupportedException
I have registered the event source as admin, and tested this works:
New-EventLog -LogName Application -Source PoshLogs Write-EventLog -LogName "Application" -Source "PoshLogs"
I tried a fresh re-install of .NET 6.0.14 SDK and full machine restart. Install was fresh today:
Install-Module -Name PoShLog Install-Module PoShLog.Sinks.EventLog
Windows Server 2019 Powershell 7.3.3
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where { $_.PSChildName -Match '^(?!S)\p{L}'} | Select PSChildName, version PSChildName Version ----------- ------- Client 4.7.03190 Full 4.7.03190 Client 4.0.0.0
Any suggestions would be appreciated.
The text was updated successfully, but these errors were encountered:
Figured it out- it fails under PowerShell ISE but works when run in pwsh version 7
Sorry, something went wrong.
The issue is actually a bug in serilog and .NET Foundation 4.8 affecting PS 5.1 and ISE: serilog/serilog-sinks-eventlog#49
No branches or pull requests
When I run the sample code as admin:
I get this error:
I have registered the event source as admin, and tested this works:
I tried a fresh re-install of .NET 6.0.14 SDK and full machine restart.
Install was fresh today:
Windows Server 2019
Powershell 7.3.3
Any suggestions would be appreciated.
The text was updated successfully, but these errors were encountered: