Forum Discussion
james_teach256
Jul 03, 2020Copper Contributor
PowerShell script for enabling user in AD via thier employee id or username
A good script for enabling user account in active directory via thier employee id or username.
- hkarthik_7Copper Contributor
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 $_
}