PowerShell script for enabling user in AD via thier employee id or username

%3CLINGO-SUB%20id%3D%22lingo-sub-1504241%22%20slang%3D%22en-US%22%3EPowerShell%20script%20for%20enabling%20user%20in%20AD%20via%20thier%20employee%20id%20or%20username%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1504241%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20good%20script%20for%20enabling%20user%20account%20in%20active%20directory%20via%20thier%20employee%20id%20or%20username.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1504241%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EActive%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

 

A good script for enabling user account in active directory via thier employee id or username.

1 Reply

Hi @james_teach256, User accounts can be enabled with the SamAccountNames. You can place the SamAccountNames in a text file and execute the below script to enable the user accounts in bulk. Also, note that this should be executed from a domain controller. 

 

Import-Module ActiveDirectory

 

# Place all the SamAccountNames in a text file
(Get-Content "C:\TEMP\ADUsers.txt") | ForEach-Object {
Enable-ADAccount -Identity $_
}