Get-WinEvent - Suggested enhancements
See original GitHub issueSteps to reproduce
Get-WinEvent
Expected behavior
A user friendly error message when running from a non-elevated session, stating that elevated permissions is needed.
I would suggest that the behavior of the default parameter set prompts for required parameters rather than returning cryptic error messages. For example, prompt for the -LogName parameter if no parameters is supplied.
Actual behavior
Get-WinEvent : Could not retrieve information about the Security log. Error: Attempted to perform an unauthorized operation..
At line:1 char:1
+ Get-WinEvent
+ ~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], Exception
+ FullyQualifiedErrorId : LogInfoUnavailable,Microsoft.PowerShell.Commands.GetWinEventCommand
Get-WinEvent : The data is invalid
At line:1 char:1
+ Get-WinEvent
+ ~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], EventLogInvalidDataException
+ FullyQualifiedErrorId : The data is invalid,Microsoft.PowerShell.Commands.GetWinEventCommand
The “Get-WinEvent : The data is invalid” error is repeated many times, regardless of running elevated or not.
Environment data
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Get-WinEvent (Microsoft.PowerShell.Diagnostics)
This command gets all the event logs on the local computer. Logs are listed in the order that Get-WinEvent gets them. Classic logs...
Read more >Using Get-WinEvent to look into the past
Get -WinEvent is the newer revamped version of Get-EventLog , and there are two improvements I believe are worth mentioning.
Read more >Event Log query with Get-WinEvent / Get-EventLog is very ...
I've implemented the aforementioned concepts and timed the improvements for each to show the difference in performance using the Measure-Command ...
Read more >Need example of how to use FilterHashTable of Get- ...
Where you can supposedly filter on a named data field. I've never been able to get it to work. Google all I may,...
Read more >Mimic event viewer filtering with Get-WinEvent
Looks OK but might run very slow on busy systems. The end sort should be unnecessary as you are doing a time-linear query...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@KevinMarquette See #10648
@Robo210 Thanks! As soon as we get feedback with a real scenario, we can improve something.