Preparing the PowerShell Environment
Import the ActiveDirectory Module
Import-Module ActiveDirectory
Import the ActiveDirectory module to manage AD DS and LDS from PowerShell.
Create a Single User
Single User Creation Script
Maintain a reusable .ps1 template, update attributes, and execute to quickly provision a user.

Batch User Creation in AD
Import Users from CSV
- Create a CSV with user attributes.
- Import the CSV in a script and call
New-ADUserfor each row. - Verify in ADUC (e.g., TestUsers OU).


Reset a User's Password
Set-ADAccountPassword
- Use
Set-ADAccountPasswordto reset.
Set-ADAccountPassword -Identity "BTest" -NewPassword (ConvertTo-SecureString "summer2025!" -AsPlainText -Force ) -Reset
- Optionally enforce password change at next logon.
Set-ADUser -Identity "BTest" -ChangePasswordAtLogon $true
Apply a GPO to Users via OU Link
New-GPLink
New-GPLink -Name "Disable Control Panel" -Target "OU=TestUsers,DC=Domain-1,DC=local"
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 GPO Apply Permissions
- 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.
Set-GPPermission -Name "Disable Control Panel" -TargetName "DRicks" -PermissionLevel GpoApply
Remove Authenticated Users
Set-GPPermissions -Name "Disable Control Panel" -TargetName "Authenticated Users" -TargetType Group -PermissionLevel None