Windows Server 2022 Event Query Error for Older Versions

jelloland 51 Reputation points
2022-09-12T17:01:27.44+00:00

We recently updated/replaced some servers with Server 2022 and I noticed a PowerShell script that was no longer working right. When I looked into it some more, it seems to be when querying event logs on older server versions (e.g. 2019, 2016).

Here is a boiled down snippet I've cobbled up to easily reproduce the issue:

PS C:\Users\svr2022> Get-WinEvent -ComputerName svr2016 -FilterHashtable @{LogName="System";ProviderName="EventLog"} -MaxEvents 1  
  
Get-WinEvent : We do not have 18 variants given for the  UnsafeNativeMethods.EvtRenderFlags.EvtRenderEventValues flag.  
(System Properties)  
At line:1 char:1  
+ Get-WinEvent -ComputerName svr2016 -FilterHashtable @{LogName="Syst ...  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
    + CategoryInfo          : NotSpecified: (:) [Get-WinEvent], InvalidOperationException  
    + FullyQualifiedErrorId : We do not have 18 variants given for the  UnsafeNativeMethods.EvtRenderFlags.EvtRenderEv  
   entValues flag. (System Properties),Microsoft.PowerShell.Commands.GetWinEventCommand  

This query works fine against other 2022 servers.

I've updated the 2022 server to 20348.946 but am still experiencing the issue.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,939 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,510 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Rich Matheisen 46,556 Reputation points
    2022-09-12T17:50:24.34+00:00

    This seems to be a known problem with .Net. See here: 60740


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.