Jump to content


  • 0
kmercer6

Filtering Security Logs

Question

We currently have a Powershell script that runs and grabs the security logs from our Domain controllers. We would like to either filter out results from the created .csv file or adjust the script to give us all the data for a certain event ID. The below is a copy of the current Powershell script we use to grab the logs.

 

cls

$computer = gc env:computername

$mypath = "c:\"

$dt=(get-date).AddDays(-1).tostring("MM-dd-yyyy")

$obj = New-Object System.Globalization.CultureInfo -ArgumentList "en-US"

$before = [DateTime]::Parse((get-date).tostring("MM-dd-yyyy"), $obj)

$after = [DateTime]::Parse((get-date).AddDays(-1).tostring("MM-dd-yyyy"), $obj)

get-eventlog -logname security -after $after -Before $before|Export-Csv $mypath""$computer"_security_log_$dt.csv"

 

Any ideas?

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.