Site icon Kommands.com

How to View Active Directory Changes from the Last 7 Days with PowerShell

Auditing recent changes in Active Directory is essential for troubleshooting, security reviews, and general hygiene. While AD doesn’t keep a simple “change history,” we can query attributes like whenChanged to see what objects were modified recently.

This post shows a clean PowerShell script you can run to list AD changes from the past 7 days.


What this script does


Requirements


PowerShell Script: AD Changes – Last 7 Days

Import-Module ActiveDirectory

# Define time range
$DaysBack = 7
$SinceDate = (Get-Date).AddDays(-$DaysBack)

# Get recently changed AD objects
$ChangedObjects = Get-ADObject `
    -Filter { whenChanged -ge $SinceDate } `
    -Properties whenChanged, objectClass, name, distinguishedName, modifiedBy `
    -ResultSetSize $null

# Select useful fields
$Results = $ChangedObjects | Select-Object `
    Name,
    objectClass,
    whenChanged,
    distinguishedName

# Display results
$Results | Sort-Object whenChanged -Descending | Format-Table -AutoSize

# Optional: export to CSV
$ExportPath = "C:\Temp\AD_Changes_Last_7_Days.csv"
$Results | Export-Csv -Path $ExportPath -NoTypeInformation

Write-Host "Exported results to $ExportPath"

Example Output

NameObjectClassWhenChanged
jsmithuser2025-12-20 14:32
IT_Adminsgroup2025-12-19 09:11
WS-023computer2025-12-18 16:44

Important Limitations (Know This)

This method:

That’s because:


Want More Detail? (Advanced)

If you need:

You must:

That’s a more advanced setup, but far more powerful.


Quick Tip

For ongoing monitoring, many admins:


Summary

If you just need a quick, reliable snapshot of AD activity from the last 7 days, this script is simple and effective. For compliance-grade auditing, pair it with Security Event Logs.

Exit mobile version