How to read event logs of a server

Welcome Forums General PowerShell Q&A How to read event logs of a server

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
4 months ago.

  • Author
    Posts
  • #102958

    Participant
    Points: 0
    Rank: Member

    I ran the following command from another machine in the same domain.

    Get-EventLog -LogName "Application" -ComputerName "Server01"

    I tried using the following command: But it says "Cannot open log Application on machine Server01. Windows has not provided an error code.

    I want to dump entire logs under "Application" into some file.

    Any suggestions please

    thank you

  • #102967

    Participant
    Points: 3
    Rank: Member
  • #102994

    Participant
    Points: 3
    Rank: Member

    I do this, see below, which works fine for me....

    Get-EventLog -ComputerName "servername" -Log "Application" -After (Get-Date).AddDays(-1) -EntryType Error,Warning  |`
     Export-Excel -Path $xlsxFile -WorkSheetname "SQL Server"
    

    Just need the ImportExcel module

    • #102997

      Participant
      Points: 3
      Rank: Member

      Just because it annoys me everytime I see this: You don't need a backtick after a pipe symbol to be able to use a line break. Line breaks are allowed after Pipe symbols, commata, semikola, opening parenthesis, openeing squere brackets and opening curly braces. I'm used to think that's really enough to avoid the backticks. 😉 😀

The topic ‘How to read event logs of a server’ is closed to new replies.