none
I need script which can take the remote machine names from a text file as input and return the particular event ID status of all the servers. System event ID 19.

    Question

  • I need script which can take the remote machine names from a text file as input and return the particular event ID status of all the servers. System event ID 19.
    Friday, March 02, 2012 7:07 AM

Answers

  • get-eventlog -computername "hostname" -log application -source outlook | where {$_.eventID -eq 34}

    Get-EventLog cmdlet can query remote macines for specific eventid, sources and data ranges.

    To get all computers from a text file and query events;

    Get-Content c:\names.txt | ForEach-Object {get-eventlog -computername "hostname" -log application -source outlook | where {$_.eventID -eq 34}}

    Friday, March 02, 2012 7:28 AM
  • Hi,

    Thank you for the post.

    You could also use Get-EventsByWmi.ps1 script to achieve it.
    Get-EventsByWmi.ps1 -computer c:\myservers.txt -log system -eventid 19

    If there are more inquiries on this issue, please feel free to let us know.

    Regards


    Rick Tan

    TechNet Community Support

    Monday, March 05, 2012 3:15 AM

All replies

  • get-eventlog -computername "hostname" -log application -source outlook | where {$_.eventID -eq 34}

    Get-EventLog cmdlet can query remote macines for specific eventid, sources and data ranges.

    To get all computers from a text file and query events;

    Get-Content c:\names.txt | ForEach-Object {get-eventlog -computername "hostname" -log application -source outlook | where {$_.eventID -eq 34}}

    Friday, March 02, 2012 7:28 AM
  • Hi,

    Thank you for the post.

    You could also use Get-EventsByWmi.ps1 script to achieve it.
    Get-EventsByWmi.ps1 -computer c:\myservers.txt -log system -eventid 19

    If there are more inquiries on this issue, please feel free to let us know.

    Regards


    Rick Tan

    TechNet Community Support

    Monday, March 05, 2012 3:15 AM
  • Hi...getting below error.

    PS C:\> C:\Users\gchand-admin\Desktop\Get-EventsByWmi.ps1 -computer c:\Servers.t
    xt -log system -eventid 19
    Querying system Log for EventID: 19
    Get-WmiObject : Invalid parameter
    At C:\Users\gchand-admin\Desktop\Get-EventsByWmi.ps1:22 char:15
    +  Get-WmiObject <<<<  -Class win32_NTLogEvent -filter "logfile = '$log' and Ev
    entCode = '$eventID'" -computerName $computerName
        + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], Managemen
       tException
        + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
       ommands.GetWmiObjectCommand

    Completed querying c:\Servers.txt.length computers
    PS C:\>

    Saturday, May 19, 2012 11:34 AM