← script library

Bulk Enable Active Directory User Accounts

Active DirectoryJanuary 5, 2025

Managing Active Directory user accounts efficiently is crucial for maintaining security and usability within an organization. This PowerShell script allows administrators to bulk enable user accounts that may have been disabled, making it easier to manage user access as needed. At ServerEngine, we provide powerful tools to streamline your server management tasks.

powershell
Import-Module ActiveDirectory

function Enable-ADUserAccounts {
    param (
        [string]$csvPath
    )
    $users = Import-Csv -Path $csvPath
    foreach ($user in $users) {
        $username = $user.UserName
        try {
            Enable-ADAccount -Identity $username
            Write-Host "Successfully enabled user: $username"
        } catch {
            Write-Host "ERROR: Could not enable user: $username. Error: $_"
        }
    }
}

Enable-ADUserAccounts -csvPath "C:\Path\To\Your\enable_users.csv"

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.