Having a weird issue (if I could event call it that). Not very well versed in Powershell/C#. I’ve tried looking up this problem with no luck. Here is a short script:
<code>CD C:WindowsSystem32
Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Object Level, LevelDisplayName, @{n='TimeCreated';e={Get-Date ($_.TimeCreated) -Format 'dd/MM/yyyy HH:mm:ss'}}, ProviderName, Id, Task, Message, LogName, UserId, TaskDisplayName | export-csv "C:ScriptsEventCollector_.csv" -UseCulture –NoTypeInformation
<code>CD C:WindowsSystem32
Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Object Level, LevelDisplayName, @{n='TimeCreated';e={Get-Date ($_.TimeCreated) -Format 'dd/MM/yyyy HH:mm:ss'}}, ProviderName, Id, Task, Message, LogName, UserId, TaskDisplayName | export-csv "C:ScriptsEventCollector_.csv" -UseCulture –NoTypeInformation
</code>
CD C:WindowsSystem32
Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Object Level, LevelDisplayName, @{n='TimeCreated';e={Get-Date ($_.TimeCreated) -Format 'dd/MM/yyyy HH:mm:ss'}}, ProviderName, Id, Task, Message, LogName, UserId, TaskDisplayName | export-csv "C:ScriptsEventCollector_.csv" -UseCulture –NoTypeInformation
I run this script to collect application logs from Event Viewer using an XML file called “Admin.xml” in the system32 folder. Whenever I run it I get the following errors:
<code>PS C:UsersAdministrator> cd C:Scripts
PS C:Scripts> .eventcollector.ps1
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
<code>PS C:UsersAdministrator> cd C:Scripts
PS C:Scripts> .eventcollector.ps1
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
</code>
PS C:UsersAdministrator> cd C:Scripts
PS C:Scripts> .eventcollector.ps1
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
Get-WinEvent : The description string for parameter reference (%1) could not be found
At C:ScriptsEventCollector.ps1:2 char:1
+ Get-WinEvent -FilterXml ([xml](Get-Content "Admin.xml")) | Select-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogException
+ FullyQualifiedErrorId : The description string for parameter reference (%1) could not be found,Microsoft.PowerSh
ell.Commands.GetWinEventCommand
I get these errors in the console, but The output .csv still populates properly. So I’m not too sure if it’s just skipping over whatever throws this error?
This is running on an up-to-date Windows 2022 Server. I tried running the script on Windows 2016 and Windows 2019 servers, and get no errors.
Is this something I should be worried about? Or is it not a problem?
If it isn’t a problem, how can I get the errors to stop showing up?