Setting Up Active Directory Lab: Part 2
Security and Pentest Home Lab Environment
π οΈ Active Directory Lab Setup - Part 2
In the previous module, we installed Windows Server 2019
, configured Active Directory Domain Services
, set up DNS Forwarding
, and enabled DHCP
. In this module, weβll complete the Domain Controller setup and begin integrating devices into the AD environment.
ποΈ Certificate Services Installation
π Install AD Certificate Services
- Open
Server Manager
β ClickManage
βAdd Roles and Features
- Click
Next
until the Server Roles page - Enable
Active Directory Certificate Services
β ClickAdd Features
- Click
Next
until the Role Services page - Enable
Certificate Authority
β ClickNext
- Click
Install
to begin setup - After installation, restart the server: Β Β -
Start
βPower
βRestart
β ClickContinue
βοΈ Configure Certificate Services
- After reboot, open
Server Manager
- Click the flag icon β Select
Configure Active Directory Certificate Services
- Click
Next
- Enable
Certification Authority
β ClickNext
- Continue clicking
Next
until the Confirmation page - Click
Configure
β ThenClose
π€ User Configuration
π¨βπΌ Create Domain Admin
- Open
Start
βWindows Administrative Tools
βActive Directory Users and Computers
- Right-click your domain (e.g.,
ad.lab
) βNew
βUser
- Enter: Β Β - First Name, Last Name Β Β - User logon name (e.g.,
admin.ad
) - Set a password β Uncheck all options except
Password never expires
β ClickNext
- Expand the domain β Click
Users
β Double-clickDomain Admins
- Go to
Members
β ClickAdd
- Enter the new userβs name β Click
Check Names
βOK
- Click
Apply
βOK
- Sign out β From login screen, select
Other user
β Log in with the new domain admin credentials
π€ Create AD User 1
- Open
Active Directory Users and Computers
- Right-click the domain β
New
βUser
- Enter user details
- Set a password β Check: Β Β -
User cannot change password
Β Β -Password never expires
- Click
Next
βFinish
π€ Create AD User 2
Repeat the same steps as above to create a second AD user.
π§ͺ Making the AD Lab Exploitable
β οΈ Optional: This section is for creating a vulnerable AD environment for testing and learning purposes. Skip this if you do not intend to simulate attacks.
π» Run Vulnerable AD Script
- Right-click
Start
β SelectWindows PowerShell (Admin)
- Run the following commands:
1
2
3
4
5
# Allow script execution
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
# Download and execute the vulnerable AD script
[System.Net.WebClient]::new().DownloadString('https://raw.githubusercontent.com/WaterExecution/vulnerable-AD-plus/master/vulnadplus.ps1') -replace 'change\.me', 'ad.lab' | Invoke-Expression
π‘οΈ Group Policy Configuration
With the Domain Controller fully set up, we will now configure Group Policies to manage security settings, remote access, and administrative behavior across the AD environment.
π« Disable Windows Defender & Firewall
- Open
Start
βWindows Administrative Tools
βGroup Policy Management
- Expand:
Forest
βDomains
β your domain (e.g.,ad.lab
) - Right-click the domain β
Create a GPO in this domain and link here
Β Β - Name:Disable Protections
- Right-click
Disable Protections
βEdit
π§ Disable Defender Antivirus
- Navigate to:Β Β
Computer Configuration
βPolicies
βAdministrative Templates
βWindows Components
βWindows Defender Antivirus
- Double-click
Turn off Windows Defender Antivirus
β Set toEnabled
β ClickApply
βOK
- Double-click
Real-time Protection
β EditTurn off real-time protection
β Set toEnabled
βApply
βOK
π§ Disable Firewall
- Navigate to:Β Β
Computer Configuration
βPolicies
βAdministrative Templates
βNetwork
βNetwork Connections
βWindows Defender Firewall
βDomain Profile
- Edit
Windows Defender Firewall: Protect all network connections
β Set toDisabled
βApply
βOK
- Close the editor β Right-click
Disable Protections
in Group Policy Management β SelectEnforced
π Enable Remote Login for Local Admins
- Right-click the domain β
Create a GPO in this domain and link here
Β Β - Name:Local Admin Remote Login
- Right-click
Local Admin Remote Login
βEdit
- Navigate to:Β Β Β
Computer Configuration
βPreferences
βWindows Settings
βRegistry
- Right-click
Registry
βNew
βRegistry Item
π§Ύ Registry Item Settings
- Hive:
HKEY_LOCAL_MACHINE
Β - Key Path:
SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Β - Value name:
LocalAccountTokenFilterPolicy
Β - Value type:
REG_DWORD
Β - Value data:
1
Click Apply
β OK
β Close the editor
π Enable WinRM Server
- Right-click the domain β
Create a GPO in this domain and link here
Β Β - Name:Enable WinRM Server
- Right-click
Enable WinRM Server
βEdit
π§ WinRM Settings
- Navigate to:Β Β
Computer Configuration
βPolicies
βAdministrative Templates
βWindows Components
βWindows Remote Management (WinRM)
βWinRM Service
- Edit
Allow remote server management through WinRM
β Set toEnabled
Β Β - IPv4 filter:*
βApply
βOK
- Edit
Allow Basic authentication
βEnabled
βApply
βOK
- Edit
Allow unencrypted traffic
βEnabled
βApply
βOK
π§ Start WinRM Service
- Navigate to:Β Β
Computer Configuration
βPreferences
βControl Panel Settings
βServices
- Right-click
Services
βNew
βService
Β - Startup:Automatic
Β - Service Name:Windows Remote Management (WS-Management)
Β - Service Action:Start service
βApply
βOK
π§ Enable Remote Shell
- Navigate to:Β Β
Computer Configuration
βPolicies
βAdministrative Templates
βWindows Components
βWindows Remote Shell
- Edit
Allow Remote Shell Access
β Set toEnabled
βApply
βOK
π₯οΈ Enable RDP (Remote Desktop Protocol)
- Right-click the domain β
Create a GPO in this domain and link here
Β Β - Name:Enable RDP
- Right-click
Enable RDP
βEdit
- Navigate to:Β Β Β
Computer Configuration
βPolicies
βAdministrative Templates
βWindows Components
βRemote Desktop Services
βRemote Desktop Session Host
βConnections
- Edit
Allow users to connect remotely using Remote Desktop Services
β Set toEnabled
βApply
βOK
π Enable RPC (Remote Procedure Call)
- Right-click the domain β
Create a GPO in this domain and link here
Β Β - Name:Enable RPC
- Right-click
Enable RPC
βEdit
- Navigate to:Β Β Β
Computer Configuration
βAdministrative Templates
βSystem
βRemote Procedure Call
- Edit
Enable RPC Endpoint Mapper Client Authentication
β Set toEnabled
βApply
βOK
π₯ Enforce Domain Policies
- Open
Windows PowerShell (Admin)
- Run the following command:
1
gpupdate /force
π» Windows 10 Enterprise VM1 Setup
πΏ OS Installation
- Select
Windows 10 Enterprise VM1
β ClickStart
- Click
Next
βInstall now
- Accept the license β Click
Next
- Choose:
Custom: Install Windows only (advanced)
- Select
Disk 0
β ClickNext
- The VM will reboot several times during installation
- Select your Region and Keyboard Layout β Click
Skip
- Choose
Domain join instead
to create a local account - Enter a username (e.g.,
John
) β ClickNext
- Set a password β Click
Next
- Configure Security Questions β Click
Next
- Disable all features β Click
Accept
- Select
Not now
when prompted for additional setup - On the desktop, click
Yes
to allow internet access
π¦ Guest Additions Installation
- From the VM toolbar:Β Β Β -
Devices
βRemove disk from virtual drive
- Then:Β Β Β -
Devices
βInsert Guest Additions CD image
- Open File Explorer β Select the mounted disk
- Run
VBoxWindowsAdditions
- Click
Next
βNext
βInstall
- Choose
Reboot now
β ClickFinish
- After reboot, remove the Guest Additions disk
- Use
Right Ctrl + F
to toggle fullscreen mode
π·οΈ Adding VM1 to the Domain
- Search for
This PC
β Right-click βProperties
- Click
Advanced system settings
βComputer Name
tab βChange
- Set a Computer Name (e.g.,
WIN10-JOHN
) - Under Member of, select
Domain
β Enter:ad.lab
- Click
More
β Set Primary DNS suffix toad.lab
β ClickOK
- Enter Domain Admin credentials β Click
OK
- Click
OK
through confirmation prompts β ClickRestart Now
- On login screen β Select
Other user
- Enter AD user credentials (e.g.,
ad.lab\john
) β PressEnter
- Open PowerShell β Run
whoami
to confirm domain login
π» Windows 10 Enterprise VM2 Setup
Follow the same steps as above to configure the second VM for the second user (e.g., Jane
).
- Use the first name of the second AD user during local account setup
- Join the domain using the same process
- Log in using the second AD users credentials
π Appendix
π§© Lab Summary
In this module, we:
- Set up 3 VMs: Β -
Windows Server 2019
as the Domain Controller Β - TwoWindows 10 Enterprise
VMs as client devices - Enabled: Β - DHCP Β - DNS Forwarding Β - AD Certificate Services Β - Group Policies for all domain devices
π§Ή You may delete the Windows Server 2019 ISO if not needed.Β Keep the Windows 10 ISO for future use (e.g., FlareVM setup).
π DNS & DHCP Verification
- Open DHCP Manager β Confirm IP addresses match assigned values
- Open DNS Manager β Verify DNS entries for client devices
πΈ Taking VM Snapshots
β οΈ Power off VMs before taking snapshots to avoid instability
- Select a VM β Click the
β°
(hamburger menu) βSnapshots
- Click
Take
β Enter a descriptive name β ClickOK
- Repeat for: Β Β -
Windows Server 2019
Β Β -Windows 10 Enterprise VM1
Β Β -Windows 10 Enterprise VM2
- Return to VM settings via
β°
βDetails
π§ͺ Alternative AD Setup
Explore more AD lab variations:
- How to Setup a Basic Home Lab Running Active Directory β YouTube
- How to Build an Active Directory Hacking Lab β YouTube
𧨠Hacking AD Lab
Learn about common AD attack techniques:
π Whatβs Next?
With the AD Lab complete, we are ready to move on to malware analysis.