Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

Email Event viewer logs from servers

Home Forums Scripting PowerShell Email Event viewer logs from servers

Viewing 1 post (of 1 total)
  • Author
    Posts

  • todd231
    Participant
    #614305

    Get-WinEvent -LogName $LogName -MaxEvents 1000 -EA SilentlyContinue | Where-Object {$_.id -in $EventID -and $_.Timecreated -gt (Get-date).AddHours(-24)} | Sort TimeCreated -Descending | Export-Csv c:\transfer\testexport.csv -NoTypeInformation

     

    Send-MailMessage -From [email protected]-To [email protected] -SmtpServer smtp.theirdomain.com  -Subject test export -Body $Body -Attachments $Path

     

    My assumption, probably incorrect, is that the $logname if left blank will gather all event viewer logs, or do I need specify Security, Application, etc for what I want.

     

    I should be able to set this up as a script to run on a scheduled task as well, if I’m not mistaken.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: