question

mukka-4041 avatar image
0 Votes"
mukka-4041 asked IanXue-MSFT answered

Get the Events from Specific Event ID to Specific Event ID (2 User Input : Event ID Upper Limit and Event ID Lower Limit)

Get the Events from Specific Event ID to Specific Event ID (2 User Input : Event ID Upper Limit and Event ID Lower Limit)

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered

Hi,

Please try this. Set $LogName to the name of the log you want to check.

 $LowerLimit = Read-Host -Prompt "Lower Limit"
 $UpperLimit = Read-Host -Prompt "Upper Limit"
 $LogName = "Microsoft-Windows-PowerShell/Operational"
 Get-WinEvent -LogName $LogName | Where-Object { ($_.id -gt $LowerLimit) -and ($_.id -lt $UpperLimit)}

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.