Managing AD & GP with PowerShell
Import the AD module, create users (single & batch), reset passwords, and link or scope GPOs with OU links and security filtering—all from PowerShell.
Preparing the PowerShell Environment
Import the ActiveDirectory module to manage AD DS and LDS from PowerShell.
Create a Single User
Maintain a reusable .ps1
template, update attributes, and execute to quickly provision a user.
Batch User Creation in AD
- Create a CSV with user attributes.
- Import the CSV in a script and call
New-ADUser
for each row.
- Verify in ADUC (e.g., TestUsers OU).
Reset a User’s Password
- Use
Set-ADAccountPassword
to reset.
- Optionally enforce password change at next logon.
Apply a GPO to Users via OU Link
Link an existing GPO to an OU to target all user objects within (unless further constrained by security filtering).
Target a Specific User with Security Filtering
- Grant the user (or a security group) Read and Apply Group Policy on the GPO.
- Optional: Remove Authenticated Users from Security Filtering if you want exclusive targeting.
- Be cautious—ensure the correct principals retain required rights.