AD PowerShell Toolset

Active Directory Automator

Streamlining User Management & Reporting

Why Use PowerShell for AD?

Efficiency

Perform bulk actions on thousands of users in seconds—tasks that would take hours in the GUI.

Consistency

Eliminate human error by using standardized logic for naming conventions and permissions.

Reporting

Easily export audit-ready reports to CSV or HTML formats for compliance reviews.

The Script

Below is the core logic for retrieving inactive users and exporting them to a report.

Get-InactiveUsers.ps1

# Import AD Module
Import-Module ActiveDirectory

# Define Timespan (90 days)
$DaysInactive = 90
$Time = (Get-Date).AddDays(-$DaysInactive)

# Fetch and Export
Get-ADUser -Filter 'LastLogonDate -lt $Time' -Properties LastLogonDate | 
    Select-Object Name, SamAccountName, LastLogonDate | 
    Export-Csv -Path ".\InactiveUsers.csv" -NoTypeInformation

Write-Host "Report Generated Successfully!" -ForegroundColor Cyan
                

Deep Dive & Documentation

Want to know how to schedule this script or customize the filters?

Read the Full Blog Post