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

Ravalika Mukka 21 Reputation points
2021-07-09T05:38:52.41+00:00

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
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,462 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor
    2021-07-09T08:03:19.447+00:00

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful