Keep up with tech in 5 minutes
TLDR is the free daily email with summaries of the most interesting stories in startups, tech, and programming. The stuff worth knowing, minus the doomscrolling.
Issues are curated by ex-Google and Anthropic engineers and land in your inbox before your morning coffee. A 5-minute read, and you walk into the day already knowing what your team is still catching up on.
Tech is just the start. We also cover AI, marketing, dev, and more. Pick the briefs that match your work.
Free, daily, and read by 7M+ subscribers. Subscribe and let the experts do the digging for the tech news that matters.
THE PROBLEM
Every Sysadmin has been there — HR emails you a list of new starters, leavers, and role changes. You spend the next two hours manually creating accounts, resetting passwords, disabling leavers, and updating group memberships. It's repetitive, error-prone, and a complete waste of your time. This week we automate the entire process from a CSV file.
THE SCRIPT
Save the script below to:
C:\Scripts\ADUserManagement.ps1PowerShell
# Active Directory User Management Automation
# Automate & Operate — automateandoperate.com
# Settings — update these
$csvPath = "C:\Scripts\users.csv"
$from = "[email protected]"
$to = "[email protected]"
$smtpServer = "smtp.gmail.com"
$smtpPort = 587
$username = "[email protected]"
$password = ConvertTo-SecureString "yourpassword" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
$logFile = "C:\Logs\ADUserManagement.log"
$defaultPassword = ConvertTo-SecureString "Welcome123!" -AsPlainText -Force
# Create log folder if missing
if (-not (Test-Path "C:\Logs")) {
New-Item -ItemType Directory -Path "C:\Logs"
}
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$log = @()
# Import CSV
$users = Import-Csv -Path $csvPath
foreach ($user in $users) {
$action = $user.Action.Trim().ToUpper()
$username = $user.Username.Trim()
$firstName = $user.FirstName.Trim()
$lastName = $user.LastName.Trim()
$ou = $user.OU.Trim()
$group = $user.Group.Trim()
switch ($action) {
"CREATE" {
try {
New-ADUser `
-Name "$firstName $lastName" `
-GivenName $firstName `
-Surname $lastName `
-SamAccountName $username `
-UserPrincipalName "$username@yourdomain.com" `
-Path $ou `
-AccountPassword $defaultPassword `
-Enabled $true `
-ChangePasswordAtLogon $true
Add-ADGroupMember -Identity $group -Members $username
$log += "$timestamp — CREATED: $username added to $group"
} catch {
$log += "$timestamp — FAILED CREATE: $username — $_"
}
}
"DISABLE" {
try {
Disable-ADAccount -Identity $username
$log += "$timestamp — DISABLED: $username"
} catch {
$log += "$timestamp — FAILED DISABLE: $username — $_"
}
}
"RESET" {
try {
Set-ADAccountPassword -Identity $username -NewPassword $defaultPassword -Reset
Set-ADUser -Identity $username -ChangePasswordAtLogon $true
$log += "$timestamp — PASSWORD RESET: $username"
} catch {
$log += "$timestamp — FAILED RESET: $username — $_"
}
}
}
}
# Write log
$log | ForEach-Object { Add-Content -Path $logFile -Value $_ }
# Send summary email
$emailBody = "AD User Management Summary — $timestamp`n`n"
$emailBody += $log -join "`n"
$emailBody += "`n`nAutomate & Operate — automateandoperate.com"
Send-MailMessage `
-From $from -To $to `
-Subject "AD Management Complete — $($log.Count) actions on $env:COMPUTERNAME" `
-Body $emailBody `
-SmtpServer $smtpServer -Port $smtpPort `
-UseSsl -Credential $credentialYOUR CSV FILE FORMAT
Create a file called users.csv and save it to C:\Scripts\. Format it exactly like this:
Action,Username,FirstName,LastName,OU,Group
CREATE,jsmith,John,Smith,"OU=Users,DC=yourdomain,DC=com",IT-Staff
DISABLE,bjones,Bob,Jones,"OU=Users,DC=yourdomain,DC=com",IT-Staff
RESET,mwilliams,Mary,Williams,"OU=Users,DC=yourdomain,DC=com",HR-StaffThree actions supported:
CREATE— creates a new AD user, sets temp password, forces password change at loginDISABLE— disables a leaver's account immediatelyRESET— resets password and forces change at next login
HOW TO RUN IT
Open PowerShell as administrator and run:
PowerShell
powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\ADUserManagement.ps1"Check C:\Logs\ADUserManagement.log for a full audit trail of every action taken.
SETTING UP TASK SCHEDULER
If HR sends you a CSV every Monday morning, automate the whole thing:
Press Windows key → type Task Scheduler → open it
Click "Create Basic Task" → name it
AD User ManagementTrigger: Weekly → Monday → 9:00am
Action: Start a program
Program:
powershell.exeArguments:
-ExecutionPolicy Bypass -File "C:\Scripts\ADUserManagement.ps1"Click Next → Finish
Now every Monday at 9am it processes whatever is in the CSV automatically and emails you a summary.
WHY THIS MATTERS
Manual AD management is where mistakes happen — wrong OU, forgotten group memberships, leavers still active weeks later. This script creates a full audit trail, enforces consistency, and turns a 2 hour task into 2 minutes. Drop the CSV, run the script, check your email. Done.
THIS WEEK'S ACTION
Test this in a lab environment first — create one test user, disable one test user, reset one password. Confirm the log and email work correctly. Then roll it out to production next Monday.
Reply to this email if you hit any issues — I read every reply.
Automate & Operate — automateandoperate.com

