Active Directory users, groups and OUs
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Core administration and security
-
Phase 3: Enterprise infrastructure
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
Most day-to-day AD work is about people: new joiners, leavers, moves between teams, and “can you give Priya access to the Finance folder?”. If you manage Active Directory users and groups well, in a tidy OU structure, those requests stay quick and safe instead of turning into a tangle nobody understands.
You’ll build an OU structure for the lab, create users by hand and from a CSV file, set up groups the way experienced admins do (AGDLP), and switch on the AD Recycle Bin so a deleted account can come back in seconds.
| Time | You need | By the end you can |
|---|---|---|
| About 60 minutes | DC01 promoted to saatlab.internal (Lesson 11) | Design OUs, create users and groups with PowerShell, bulk-create users from CSV, explain group scopes and AGDLP, enable the Recycle Bin and restore a deleted user |
What it is, in one line
Active Directory users and groups are the accounts people sign in with and the groups you add them to for access, all organised into OUs so they can be managed and delegated.
In Simple Words
Students, clubs and classrooms
A school has students (users), and it groups them in two separate ways. Classrooms (OUs) decide where a student sits and which teacher looks after them, while clubs (groups) decide what a student can use, so the chess club gets the chess room and the football club gets the field. A sensible school never hands a room key to one student by name. It gives the key to the club and adds students to the club, so when someone leaves the club they lose the room automatically and nobody has to keep track of every door. Good admins use AD the same way: users sit in OUs for management and in groups for access, and permissions always go to groups.
Engineer's View
Accounts, OUs, groups and the Recycle Bin
User accounts carry a few different names. There’s the display name (Priya Sharma), the sAMAccountName used in SAATLAB\priya.sharma (20 characters max), and the userPrincipalName (UPN) priya.sharma@saatlab.internal, which looks like an email address. Each account also has a unique SID, and that’s what permissions really point to.
OU design: build OUs around how you manage things rather than around the org chart, with separate OUs for staff, admin accounts, service accounts, servers and workstations so Group Policy and delegation can target each one. Keep it shallow, because more than three or four levels gets hard to work with. New OUs are protected from accidental deletion by default.
Group types and scopes. Security groups grant permissions, and distribution groups are only for email. The scope decides who can be a member and where the group can be used: Global (members from its own domain, usable anywhere in the forest), Domain local (members from anywhere, usable only in its own domain) and Universal (members from anywhere, usable anywhere, stored in the global catalog).
AGDLP. You put Accounts into Global groups by role (GG_Finance), put those global groups into Domain Local groups by resource and access (DL_FinanceShare_Modify), and grant Permissions only to the domain local groups. Access reviews then come down to two simple questions: who is in GG_Finance, and what is DL_FinanceShare_Modify allowed to do?
Delegation. With the Delegation of Control wizard in Active Directory Users and Computers, you can let the helpdesk reset passwords in the Staff OU only, without making them Domain Admins.
AD Recycle Bin. Once you enable it for the forest (and you can’t switch it off again), deleted objects keep all their attributes and group memberships for 180 days by default, and Restore-ADObject brings them back. Without it, a deleted user means an authoritative restore from backup (Lesson 32).
How it works, step by step
This is the OU structure you’ll build. It keeps people, admin and service accounts, servers and workstations apart, so each can get its own policies and delegation later:
You’ll notice the default Users and Computers folders aren’t used. They’re containers rather than OUs, so Group Policy can’t be linked to them, and in Lesson 19 you’ll redirect new computers into the Workstations OU automatically.
And this is AGDLP in practice, giving the Finance team change access to their shared folder:
- Accounts: Priya, Arjun and Meena are Finance staff.
- Global group: GG_Finance holds all the Finance staff and describes who they are.
- Domain local group: DL_FinanceShare_Modify describes what access it gives, and GG_Finance is a member of it.
- Permission: DL_FinanceShare_Modify is the only thing on the folder’s permissions (Lesson 16).
When Meena moves to Sales, you change one group membership and all her Finance permissions go with it, and when an auditor asks who can change the Finance share, you show them one group.
Hands-on Lab: Active Directory users and groups for saatlab.internal
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
Start DC01 and sign in as SAATLAB\Administrator. Work in PowerShell as administrator; the ActiveDirectory module loads by itself the first time you use one of its commands.
1Build the OU structure
Paste this whole block:
$base = 'DC=saatlab,DC=internal'
New-ADOrganizationalUnit -Name SAATLAB -Path $base
'Staff','Admin Accounts','Service Accounts','Groups','Servers','Workstations' |
ForEach-Object { New-ADOrganizationalUnit -Name $_ -Path "OU=SAATLAB,$base" }
'Finance','IT','Sales' |
ForEach-Object { New-ADOrganizationalUnit -Name $_ -Path "OU=Staff,OU=SAATLAB,$base" }
Get-ADOrganizationalUnit -Filter * -SearchBase "OU=SAATLAB,$base" | Sort-Object DistinguishedName | Select-Object -ExpandProperty DistinguishedNameYou should see this:
OU=Admin Accounts,OU=SAATLAB,DC=saatlab,DC=internal
OU=Finance,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal
OU=Groups,OU=SAATLAB,DC=saatlab,DC=internal
OU=IT,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal
OU=SAATLAB,DC=saatlab,DC=internal
OU=Sales,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal
OU=Servers,OU=SAATLAB,DC=saatlab,DC=internal
OU=Service Accounts,OU=SAATLAB,DC=saatlab,DC=internal
OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal
OU=Workstations,OU=SAATLAB,DC=saatlab,DC=internalEach line is a distinguished name (DN), the object’s full path in AD, which you read from right to left. OU=Finance,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal means “Finance, inside Staff, inside SAATLAB, in saatlab.internal”, and you’ll be using DNs all the time with -Path and -SearchBase.
✅ Checkpoint: Ten OUs are listed: SAATLAB itself and the nine inside it. Open Active Directory Users and Computers (dsa.msc) to see them as folders too.
2Create one user by hand
Run this. It asks for an initial password, so use one that meets the complexity rules:
$pw = Read-Host -AsSecureString 'Initial password'
New-ADUser -Name 'Priya Sharma' -GivenName Priya -Surname Sharma -SamAccountName priya.sharma `
-UserPrincipalName priya.sharma@saatlab.internal -Department Finance -Title Accountant `
-Path 'OU=Finance,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal' `
-AccountPassword $pw -ChangePasswordAtLogon $true -Enabled $true
Get-ADUser priya.sharma | Select-Object Name, UserPrincipalName, EnabledYou should see this:
Name UserPrincipalName Enabled
---- ----------------- -------
Priya Sharma priya.sharma@saatlab.internal TrueThe backtick (`) at the end of a line carries the command on to the next line. -ChangePasswordAtLogon makes Priya choose her own password when she first signs in, so you never know it.
✅ Checkpoint: priya.sharma exists, is enabled, and lives in the Finance OU.
3Create five more users from a CSV file
Create the CSV:
@'
FirstName,LastName,Department,Title
Arjun,Rao,Finance,Finance Manager
Meena,Iyer,Finance,Payroll Officer
Rahul,Verma,IT,System Administrator
Sneha,Reddy,IT,Helpdesk Engineer
Kiran,Das,Sales,Sales Executive
'@ | Set-Content C:\Lab\users.csvImport it, using the same $pw from step 2:
Import-Csv C:\Lab\users.csv | ForEach-Object {
$sam = ('{0}.{1}' -f $_.FirstName, $_.LastName).ToLower()
New-ADUser -Name "$($_.FirstName) $($_.LastName)" -GivenName $_.FirstName -Surname $_.LastName `
-SamAccountName $sam -UserPrincipalName "$sam@saatlab.internal" `
-Department $_.Department -Title $_.Title `
-Path "OU=$($_.Department),OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal" `
-AccountPassword $pw -ChangePasswordAtLogon $true -Enabled $true
"Created $sam"
}You should see this:
Created arjun.rao
Created meena.iyer
Created rahul.verma
Created sneha.reddy
Created kiran.dasCheck all staff:
Get-ADUser -Filter * -SearchBase 'OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal' -Properties Department |
Sort-Object Department, Name | Format-Table Name, SamAccountName, Department, Enabled -AutoSizeYou should see this:
Name SamAccountName Department Enabled
---- -------------- ---------- -------
Arjun Rao arjun.rao Finance True
Meena Iyer meena.iyer Finance True
Priya Sharma priya.sharma Finance True
Rahul Verma rahul.verma IT True
Sneha Reddy sneha.reddy IT True
Kiran Das kiran.das Sales TrueLook at -Properties Department. Get-ADUser only returns a handful of properties unless you ask for more, which is the same trap as in Lesson 7’s work story. This CSV pattern is how admins onboard a whole team in one go.
✅ Checkpoint: Six users appear, each in the OU for their department.

4Create groups the AGDLP way
Paste this whole block:
$groups = 'OU=Groups,OU=SAATLAB,DC=saatlab,DC=internal'
New-ADGroup -Name GG_Finance -GroupScope Global -GroupCategory Security -Path $groups
New-ADGroup -Name DL_FinanceShare_Modify -GroupScope DomainLocal -GroupCategory Security -Path $groups
Add-ADGroupMember -Identity GG_Finance -Members priya.sharma, arjun.rao, meena.iyer
Add-ADGroupMember -Identity DL_FinanceShare_Modify -Members GG_Finance
Get-ADGroupMember -Identity DL_FinanceShare_Modify -Recursive | Sort-Object Name | Select-Object Name, SamAccountNameYou should see this:
Name SamAccountName
---- --------------
Arjun Rao arjun.rao
Meena Iyer meena.iyer
Priya Sharma priya.sharma-Recursive looks inside nested groups, so you see the people who really get access through DL_FinanceShare_Modify. In Lesson 16 this group gets Modify permission on the Finance share.
✅ Checkpoint: DL_FinanceShare_Modify contains GG_Finance, and the recursive list shows the three Finance users.
5Turn on the AD Recycle Bin
Run this:
Enable-ADOptionalFeature -Identity 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target saatlab.internal -Confirm:$false
Get-ADOptionalFeature -Filter "Name -eq 'Recycle Bin Feature'" | Select-Object Name, EnabledScopesYou should see something like this:
Name EnabledScopes
---- -------------
Recycle Bin Feature {CN=Partitions,CN=Configuration,DC=saatlab,DC=internal, CN=NTDS Settings,CN=DC01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=saatlab,DC=internal}It’s a one-way switch for the whole forest, and every production forest should have it on.
✅ Checkpoint: EnabledScopes is no longer empty.
6Delete a user and bring them back
Delete Kiran and then restore him:
Remove-ADUser -Identity kiran.das -Confirm:$false
Get-ADObject -Filter "SamAccountName -eq 'kiran.das'" -IncludeDeletedObjects | Restore-ADObject
Get-ADUser kiran.das -Properties Department | Select-Object Name, Department, Enabled, DistinguishedNameYou should see this:
Name Department Enabled DistinguishedName
---- ---------- ------- -----------------
Kiran Das Sales True CN=Kiran Das,OU=Sales,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internalKiran is back in the same OU with the same department, password and group memberships. If the Recycle Bin weren’t on, you’d be restoring from a system state backup instead.
✅ Checkpoint: kiran.das is restored, enabled and back in the Sales OU.
7Delegate password resets to the helpdesk
Open Active Directory Users and Computers (dsa.msc), create a global group GG_Helpdesk in the Groups OU and add Sneha Reddy to it. Then right-click the Staff OU, choose Delegate Control, add GG_Helpdesk, tick Reset user passwords and force password change at next logon and finish the wizard.
Sneha can now reset passwords for staff, and only staff, without being a Domain Admin. You’ll use this least-privilege idea everywhere from Lesson 22 onwards.
✅ Checkpoint: GG_Helpdesk exists with Sneha in it, and the Staff OU’s Security tab (Advanced Features on) shows the delegated permission.
Break It, Then Fix It
These two catch everyone sooner or later: a password that isn’t strong enough, and an OU that won’t let you delete it.
1Break it: create a user with a weak password
Run this:
$weak = ConvertTo-SecureString 'pass123' -AsPlainText -Force
New-ADUser -Name 'Test Weak' -SamAccountName test.weak -Path 'OU=Sales,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal' -AccountPassword $weak -Enabled $trueYou’ll get an error like this:
New-ADUser : The password does not meet the length, complexity, or history requirement of the domain.
At line:2 char:1
+ New-ADUser -Name 'Test Weak' -SamAccountName test.weak -Path 'OU=Sales,O ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (CN=Test Weak,OU=...=saatlab,DC=internal:String) [New-ADUser], ADPasswordComplexityException
+ FullyQualifiedErrorId : ActiveDirectoryServer:1325,Microsoft.ActiveDirectory.Management.Commands.NewADUserThe error itself is clear enough. What’s less obvious is what happened before it, so check:
Run this:
Get-ADUser test.weak | Select-Object Name, EnabledYou should see this:
Name Enabled
---- -------
Test Weak FalseThe account was created, only disabled, because New-ADUser creates the object first and sets the password afterwards. Bulk scripts that run into this leave behind a trail of half-made, disabled accounts that confuse everyone later.
To fix it, set a proper password and enable the account, or remove it:
Set-ADAccountPassword -Identity test.weak -Reset -NewPassword (Read-Host -AsSecureString 'New password')
Enable-ADAccount -Identity test.weak
Remove-ADUser -Identity test.weak -Confirm:$false # it was only a test✅ Checkpoint: You saw the account appear disabled after the password error, and cleaned it up.

2Break it: delete an OU
Make a test OU and try to delete it:
New-ADOrganizationalUnit -Name TempOU -Path 'OU=SAATLAB,DC=saatlab,DC=internal'
Remove-ADOrganizationalUnit -Identity 'OU=TempOU,OU=SAATLAB,DC=saatlab,DC=internal' -Confirm:$falseYou’ll get an error like this:
Remove-ADOrganizationalUnit : Access is denied
At line:2 char:1
+ Remove-ADOrganizationalUnit -Identity 'OU=TempOU,OU=SAATLAB,DC=saatla ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (OU=TempOU,OU=SAATLAB,DC=saatlab,DC=internal:ADOrganizationalUnit) [Remove-ADOrganizationalUnit], UnauthorizedAccessException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.UnauthorizedAccessException,Microsoft.ActiveDirectory.Management.Commands.RemoveADOrganizationalUnitYou’re a Domain Admin and you still get “Access is denied”. That’s because new OUs are protected from accidental deletion with a Deny permission for Everyone on deleting the OU, and it’s there because deleting an OU deletes everything inside it too.
To fix it, remove the protection deliberately and then delete:
Set-ADOrganizationalUnit -Identity 'OU=TempOU,OU=SAATLAB,DC=saatlab,DC=internal' -ProtectedFromAccidentalDeletion $false
Remove-ADOrganizationalUnit -Identity 'OU=TempOU,OU=SAATLAB,DC=saatlab,DC=internal' -Confirm:$falseOn a real OU full of users, only do this if you’re sure, and never without the Recycle Bin switched on. The work story shows why.
✅ Checkpoint: TempOU refused to delete while protected and was deleted after you removed the protection.
This happened at work
The OU that took 300 accounts with it
An admin was tidying up old OUs in a company’s domain. One called “Contractors_Old” looked empty in the console, but only because the view was filtered. He turned off the accidental-deletion protection and deleted it, and its sub-OUs went with it, along with about 300 current contractor accounts.
Within minutes, contractors on three projects couldn’t sign in. The forest didn’t have the Recycle Bin enabled, so the deleted accounts were just “tombstones”, stripped of most of their attributes and every group membership.
Getting them back meant booting a DC into Directory Services Restore Mode, restoring the system state from the previous night’s backup and running an authoritative restore of the OU with ntdsutil. After that the group memberships had to be checked one by one, and the whole thing took most of a day.
The fix: they enabled the Recycle Bin that same evening. Deleting an OU now needs a second person, protection never gets turned off without a change ticket, and a weekly script exports every OU with its object count so “looks empty” can be checked against real numbers.
The lesson: the AD Recycle Bin costs nothing to turn on and it’ll save you on your worst day, so switch it on before you need it.
Common mistakes and troubleshooting
| Mistake or symptom | What happens | What to do instead |
|---|---|---|
| Giving permissions to individual users | Nobody can tell who has access or clean it up | AGDLP: users in global groups, global groups in domain local groups, permissions to domain local groups |
| Leaving users in the default Users container | Group Policy can’t target them | Create OUs and move objects into them |
| “The password does not meet the length, complexity…” | The user is still created, but disabled | Use a strong initial password; check for disabled leftovers |
| “Access is denied” deleting an OU as Domain Admin | Protection from accidental deletion | Remove the protection only on purpose, with the Recycle Bin on |
| Recycle Bin not enabled | Deleted objects lose attributes and memberships | Enable it once for the forest |
| Deep OU trees that copy the org chart | Hard to manage; reorganisations break it | Design around management: staff, admins, service accounts, servers, workstations |
| Get-ADUser shows empty Department or LastLogonDate | Those properties weren’t requested | Add -Properties |
| Everyone in Domain Admins | Huge risk if any account is compromised | Delegate specific rights to groups on specific OUs |
| sAMAccountName longer than 20 characters | Account creation fails or names are cut | Keep logon names short and consistent (first.last) |
Interview questions
Click a question to open it. Each one is written the way an interviewer would ask it. Under it you will see why they ask it and one way you could answer, in your own words.
Fresher level
1. Can you explain the difference between an OU and a group, like you’d explain it to a new intern?
Why they ask this: It’s a basic check, because once people mix up OUs and groups, permissions and policies get messy quickly.
How you might answer: I’d say an OU is a container for managing objects, and it’s what Group Policy and delegation apply to.
A group is a list of members, and we use it to give permissions or to email lots of people at once.
2. AD has three group scopes. Can you walk me through them in simple words?
Why they ask this: They want to see you know Global, Domain local and Universal groups and where each can be used.
How you might answer: A Global group holds members from its own domain and can be used anywhere, while a Domain local group can hold members from anywhere but is only used in its own domain.
A Universal group takes members from anywhere in the forest, can be used anywhere, and is stored in the global catalog.
3. HR sends you one new joiner. How would you create that user with PowerShell instead of the GUI?
Why they ask this: They want to hear that you’ve created accounts with PowerShell and know which parameters matter.
How you might answer: I’d use New-ADUser with Name, SamAccountName, UserPrincipalName, and Path pointing at the right OU, pass AccountPassword as a secure string and add -Enabled $true.
I’d normally add -ChangePasswordAtLogon $true too, so they pick their own password the first time they sign in.
2–5 years experience
4. Say you join a team where file share permissions are given to individual users. How would you explain AGDLP to them as a better way?
Why they ask this: They want to see you manage access in a way that scales and is easy to audit.
How you might answer: With AGDLP, accounts go into Global groups by role, Global groups go into Domain Local groups by resource and access level, and permissions are given only to the Domain Local groups.
From then on, when someone joins or leaves we change a group membership rather than folder permissions, and audits get a lot simpler as well.
5. HR sends you a list of 50 new joiners on Friday afternoon. How would you get them created quickly without mistakes?
Why they ask this: They want to see you automate, but carefully, with checks before and after the change.
How you might answer: I’d ask HR for a CSV with the fields we’ve agreed and run a PowerShell script with New-ADUser, using -WhatIf first to see what it would do. Every user gets a strong first password with change at next logon, the right OU and the right groups.
The script would give me a report at the end of what it created and any errors, so I can sort those out before Monday.
6. A helpdesk colleague deleted a user account by mistake an hour ago. What do you do?
Why they ask this: They’re checking you know the AD Recycle Bin, and what you’d do if it isn’t switched on.
How you might answer: If the Recycle Bin’s enabled, I’d find the account with Get-ADObject -IncludeDeletedObjects and bring it back with Restore-ADObject, and the user keeps their groups and attributes.
If it isn’t enabled, I’d need an authoritative restore from a system state backup in DSRM, which takes far longer.
Senior level
7. You’re asked to design the OU structure for a 5,000-user company. How would you approach it?
Why they ask this: They want to see you design around delegation and Group Policy rather than the org chart.
How you might answer: I’d design around how things are managed. Admin accounts sit in their own tiers away from user accounts, and service accounts get an OU of their own. Servers go by role, workstations by type or location, and staff by region only if the helpdesk teams are regional.
I’d keep it shallow and documented, set delegation per OU and link Group Policy deliberately.
8. You find thousands of groups in AD and nobody knows what half of them do. How would you clean this up and keep it clean?
Why they ask this: They want to see you think about a group’s whole life, from the request to the day it’s removed.
How you might answer: I’d bring in naming standards and make sure every group has an owner and a description, then run regular access reviews and remove the empty or unused ones.
From then on, new groups would only come through a request process, and we’d stop giving permissions to users directly.
9. A manager says, “We ticked protect from accidental deletion, so our OUs are safe.” Do you agree?
Why they ask this: They want to know you understand what this setting really does and where it stops helping.
How you might answer: Only partly. The setting adds a Deny entry for Everyone on delete and delete subtree, which stops slips, but any admin can take it off.
So I’d back it up with the Recycle Bin, backups, change control and least privilege.
Quick quiz
Q1. Where should permissions be granted in AGDLP?
- To users
- To global groups
- To domain local groups
Show answer
C — Users go in global groups, global groups in domain local groups, and permissions go to domain local groups.
Q2. Why can’t you link Group Policy to the default Users folder?
- It is hidden
- It is a container, not an OU
- It is read-only
Show answer
B — Group Policy links to sites, domains and OUs only.
Q3. What happened when New-ADUser failed on the weak password?
- Nothing was created
- The user was created but disabled
- The OU was deleted
Show answer
B — The object is created before the password is set.
Q4. Why did Remove-ADOrganizationalUnit say “Access is denied”?
- You weren’t an admin
- The OU was protected from accidental deletion
- The OU didn’t exist
Show answer
B — A Deny ACE protects new OUs from deletion.
Q5. In the work story, why did recovery take a day?
- The backup was missing
- The Recycle Bin wasn’t enabled, so an authoritative restore was needed
- The DC was offline
Show answer
B — With the Recycle Bin, it would have been one command.
Quick recap
- Active Directory users and groups live in OUs designed around how you manage them.
- User names: display name, sAMAccountName (SAATLAB\priya.sharma) and UPN (priya.sharma@saatlab.internal).
- Group scopes: Global, Domain local, Universal; use AGDLP for permissions.
- Bulk-create users from CSV with
Import-CsvandNew-ADUser; always request extra properties with-Properties. - New OUs are protected from accidental deletion, and the Recycle Bin brings deleted objects back with
Restore-ADObject. - Delegate specific rights (like password resets) to groups on specific OUs.
Next lesson
Lesson 13: Join computers and add a second DC → You’ll install Windows 11 on CL01 and join it and SRV01 to the domain, then build DC02 on Server Core, promote it remotely and check replication between the two domain controllers.
Further reading: Active Directory users and groups
To go further with Active Directory users and groups, Microsoft’s Active Directory security groups page explains scopes and built-in groups, and the AD Recycle Bin guide covers recovery. The full plan for this course is on the Windows Server Administration course page.
