Team OS : Your Only Destination To Custom OS !!

Welcome to TeamOS Community, Register or Login to the Community to Download Torrents, Get Access to Shoutbox, Post Replies, Use Search Engine and many more features. Register Today!

Locked AD reports

Neo23

Member
Downloaded
168.9 GB
Uploaded
785.7 GB
Ratio
4.65
Seedbonus
27,874
Upload Count
0 (0)
Member for 8 years
Hi all

I have Active Directory reports I would like to do. Can somone point me to a page of powershell or a safe app that can do it? Any help would be really appreciated. Takes Neo23.

Please help if you can??????
 

Ronsonious

Member
Downloaded
27.9 GB
Uploaded
502.9 GB
Ratio
18
Seedbonus
26,040
Upload Count
0 (0)
Member for 3 years
I was bored and wrote you a powershell script.


Code:
$today = (Get-date -Format "MM-dd-yyyy")

# Stuff you may want to change #
$csv_output_path = "$ENV:USERPROFILE\Documents\active-directory-logs--$today.csv"
$logs_after = "01-21-2022" # January 21, "2022"
$domain_controller = 'dc1'
$limit = 50 # The number of newest log entries you want to receive. Higher number takes longer.
################################

$log_types = @('Directory Service', 'Security')
$properties = @(
    "Category", "CategoryNumber", "Container", "Data", 
    "EnableRaisingEvents", "Entries", "EntryType", "EventID", 
    "Index", "InstanceId", "Length", "Log", "LogDisplayName", 
    "MachineName", "MaximumKilobytes", "Message", "MinimumRetentionDays", 
    "OverflowAction", "ReplacementStrings", "Site", "Source", 
    "SynchronizingObject", "TimeGenerated", "TimeWritten", "UserName"
    )

$entry_list = @()

foreach ($type in $log_types) {

    $log = Get-EventLog -ComputerName $domain_controller -LogName $type -Before (Get-Date) -after (Get-date -Date $logs_after -Format "MM-dd-yyyy") -Newest $limit | Select-Object -Property $properties
    foreach ($entry in $log) {
            $entry_list += [PSCustomObject]@{
                "Category" = $entry.Category
                "CategoryNumber" = $entry.CategoryNumber
                "Container" = $entry.Container
                "Data" = $entry.Data
                "EnableRaisingEvents" = $entry.EnableRaisingEvents
                "Entries" = $entry.Entries
                "EntryType" = $entry.EntryType
                "EventID" = $entry.EventID
                "Index" = $entry.Index
                "InstanceId" = $entry.InstanceId
                "Length" = $entry.Length
                "Log" = $entry.Log
                "LogDisplayName" = $entry.LogDisplayName
                "MachineName" = $entry.MachineName
                "MaximumKilobytes" = $entry.MaximumKilobytes
                "Message" = $entry.Message
                "MinimumRetentionDays" = $entry.MinimumRetentionDays
                "OverflowAction" = $entry.OverflowAction
                "ReplacementStrings" = $entry.ReplacementStrings
                "Site" = $entry.Site
                "Source" = $entry.Source
                "SynchronizingObject" = $entry.SynchronizingObject
                "TimeGenerated" = $entry.TimeGenerated
                "TimeWritten" = $entry.TimeWritten
                "UserName" = $entry.UserName
            }
    }

}

$entry_list  | export-csv -Path $csv_output_path -NoTypeInformation
 
Last edited:
Top