question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get-WinEvent - Suggested enhancements

See original GitHub issue

Steps 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iSazonovcommented, Oct 3, 2019
0reactions
iSazonovcommented, Nov 25, 2019

@Robo210 Thanks! As soon as we get feedback with a real scenario, we can improve something.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found