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.
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.
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