Skip to content

Beginner-friendly PowerShell scripts and step-by-step notes for an Active Directory home lab (Windows Server + AD DS + DNS + users/OUs).

Notifications You must be signed in to change notification settings

araujopedro0325-alt/ActiveDirectoryLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 

Repository files navigation

Active Directory Home Lab (VirtualBox)

A beginner-friendly home lab that teaches the fundamentals of Active Directory by building a real Windows Server Domain Controller, configuring DNS + routing, deploying DHCP, creating users/OUs with PowerShell, and joining a Windows 10 client to the domain.

VirtualBoxServer 2019 ISOWindows 10 ISO

⬇️ Download Repo (ZIP)  •  ⬇️ Direct Download (Codeload)


Table of Contents


What this lab is

This project simulates a real business network using VirtualBox:

  • A Windows Server 2019 VM becomes the Domain Controller (DC)
  • The DC provides Active Directory Domain Services (AD DS) and DNS
  • The DC uses two network adapters:
    • Adapter 1 (NAT): internet access for the server
    • Adapter 2 (Internal Network): isolated lab network for domain traffic
  • A Windows 10 VM is created and joined to the domain

What you’ll learn

  • What a Domain Controller is and why organizations use it
  • How DNS enables domain authentication and service discovery
  • How to create OUs, users, and admin groups
  • How RRAS (NAT) routes internal traffic to the internet
  • How DHCP assigns IP addresses automatically to clients
  • How to run beginner-friendly PowerShell scripts to bulk-create users

Tools & environments

Languages / Utilities

  • PowerShell (used for bulk user creation)

Environment

  • Windows Server 2019
  • Windows 10 (21H2)
  • Oracle VirtualBox

Lab overview

You’re building a “mini company network” on your computer:

  1. Create a Server VM
  2. Install Windows Server
  3. Assign a static IP on the internal network
  4. Install AD DS and promote to a Domain Controller
  5. Create OUs + users (manual + PowerShell)
  6. Configure RRAS/NAT
  7. Install DHCP and create a scope
  8. Create a Windows 10 client and join it to the domain

Network layout (simple diagram)

Why two adapters? NAT gives internet. Internal Network keeps the lab isolated and realistic.

        (Internet)
           |
      [NAT Adapter]
           |

+---------------------------+ | Windows Server 2019 DC | | AD DS + DNS + RRAS + DHCP| | Internal IP: 172.16.0.1 | +---------------------------+ | [Internal Network] | +---------------------------+ | Windows 10 Client | | Gets IP from DHCP scope | | Joins mydomain.com | +---------------------------+


Step-by-step walkthrough

1) Downloads


2) Create the Server VM

Create a new VM for Windows Server 2019.

Create VM

3) Configure networking (NAT + Internal)

VM hardware settings

Tip: RAM and CPU can be increased based on your computer’s resources.

VM memory and CPU General VM settings Additional VM settings

VirtualBox Network adapters

  • Adapter 1: NAT (internet access)
  • Adapter 2: Internal Network (private lab network)
Network VM

4) Install Windows Server 2019 (Desktop Experience)

Start the VM:

Start VM

Mount the Server 2019 ISO:

Server 2019 ISO mount

Important: Select Desktop Experience (GUI).

Desktop Experience selection

Choose Custom: Install Windows only (Advanced):

Custom install

After restart: don’t press keys—let it boot into Windows.

Let it boot

Set the local Administrator password:

Administrator password

Send Ctrl+Alt+Del via VirtualBox:

Ctrl+Alt+Del

Log in:

Log in

5) Install VirtualBox Guest Additions

Devices → Insert Guest Additions CD Image:

Guest Additions

Open This PC → CD Drive (D) VirtualBox Guest Additions:

Guest Additions drive

Run the amd64 installer, then reboot the VM:

Guest Additions installer

6) Assign a static IP to the Domain Controller

Open network settings → Change adapter options:

Network settings Change adapter options

Rename adapters:

  • Ethernet (NAT) → Internet
  • Ethernet (Internal) → X_Internal_X
Rename adapters

Set IPv4 on X_Internal_X:

IPv4 properties

Example lab settings:

  • IP: 172.16.0.1
  • Subnet: 255.255.255.0
  • DNS: 127.0.0.1
Static IP example

7) Install AD DS and promote to Domain Controller

Server Manager → Add roles and features:

Add roles and features

Select Active Directory Domain Services:

Select AD DS

Server Manager flag → Promote this server to a domain controller:

Promote to domain controller

Create a new forest (example mydomain.com):

New forest

Set DSRM password and install:

DSRM password

Login format becomes DOMAIN\Administrator:

Domain login

  1. Create OU and user, then add to Domain Admins

Open Active Directory Users and Computers:

AD Users and Computers

Create OU _ADMINS:

Create OU

Create user inside _ADMINS:

Create user

Example naming:

a-firstinitiallastname (example: a-paraujo)

User logon name

Set password options:

Password options

Add to Domain Admins:

Member Of domain admins

Sign out and log in as the new domain user:

Sign out Other user login ```

9) Configure RRAS (NAT)

Server Manager → Add roles → Remote Access:

Remote access role

Select Routing:

Routing role service

Tools → Routing and Remote Access:

Routing and remote access tool

Configure and enable:

Configure RRAS

Choose NAT:

NAT wizard

Select Use this public interface to connect to the Internet → choose Internet → Next

If the box is grayed out, close the wizard and repeat the RRAS steps.

Public interface selection

Green arrow confirms RRAS is running:

RRAS running

10) Install DHCP + Create a Scope

Server Manager → Add roles → DHCP Server → Install.

Install DHCP

Tools → DHCP → create scope under IPv4.

DHCP tool

Right click IPv4New Scope:

New scope

Example scope name:

Scope name

Example scope range:

  • Start: 172.16.0.100
  • End: 172.16.0.200
  • Mask: 255.255.255.0
Scope range

Lease duration explanation:

Lease duration

Router (Default Gateway): 172.16.0.1 → click Add → Finish.
Then Authorize the DHCP server and Refresh.

Authorize DHCP

11) Create bulk users with PowerShell

Download the repo ZIP:

Open the extracted folder and edit names.txt (add first + last names), then save:

Open names.txt Edit names.txt

Run PowerShell ISE as Administrator:

Run ISE as admin

Open 1_CREATE_USERS.ps1:

Open script

Execution Policy (Lab note)

For lab use only (don’t do this on a real production machine): powershell Set-ExecutionPolicy Unrestricted

Change directory to your extracted script folder (example): cd C:\Users<your-username>\Desktop\AD_PS-master

cd

Run the script:

run script

Verify _USERS OU is created and populated:

Users ```

12) Create the Windows 10 Client VM

Create a new VM named Client 1 (Windows 10 64-bit):

Create client VM

Set network to Internal Network:

Client internal network

Mount Windows 10 ISO (not Server ISO):

Select Win10 ISO

Install steps:

Install Win10 No product key Custom install

Offline setup:

Region

No internet Limited setup Local user Finish setup

13) Join the Client to the Domain

Open System settings:

System

Rename this PC (advanced):

Rename advanced

Change → rename Client 1 and join your domain (example mydomain.com):

Join domain Domain name

When prompted, sign in with a domain user created earlier.

In this lab script, the password is set to Password1 for learning purposes.

Domain login prompt

While restarting, verify the DHCP lease (Scope → Address Leases):

DHCP lease

Log in to the client using Other user and your domain credentials:

Other user domain Login

Success:

Domain joined

Scripts (click to view)

⚠️ If this README is inside the active-directory-lab-scripts folder, keep these links as-is. If your README is at the repo root, update the links to: ./active-directory-lab-scripts/scripts/

Tip: You can open any .ps1 file on GitHub and click Raw to download it.


Project structure

ActiveDirectoryLab/ ├── active-directory-lab-scripts/ │ ├── scripts/ │ ├── data/ │ └── docs/ └── README.md


Troubleshooting

1) Client can’t find the domain

  • Confirm Client NIC is Internal Network
  • Confirm Client DNS points to 172.16.0.1
  • Confirm DC internal adapter is set to 172.16.0.1/24

2) Client gets no IP

  • Confirm DHCP server is Authorized
  • Confirm scope is Active
  • Confirm client is on the same internal network

3) No internet

  • DC Adapter 1 must be NAT
  • RRAS must be configured with Internet as the public interface

Roadmap / Next steps

  • Add OUs: _WORKSTATIONS, _SERVERS
  • Add basic GPOs (password policy, mapped drive, wallpaper)
  • Add file server share + NTFS permissions
  • Add CSV-based user provisioning with PowerShell
  • Add a simple diagram image (draw.io) to replace the ASCII diagram

Disclaimer

This lab is for learning/testing in a controlled environment. Do not expose these VMs directly to the public internet.

About

Beginner-friendly PowerShell scripts and step-by-step notes for an Active Directory home lab (Windows Server + AD DS + DNS + users/OUs).

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published