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
Nextuntil the Server Roles page - Enable
Active Directory Certificate Servicesβ ClickAdd Features - Click
Nextuntil the Role Services page - Enable
Certificate Authorityβ ClickNext - Click
Installto 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
Nextuntil 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 Protectionsin 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 insteadto 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 nowwhen prompted for additional setup - On the desktop, click
Yesto 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 + Fto toggle fullscreen mode
π·οΈ Adding VM1 to the Domain
- Search for
This PCβ Right-click βProperties - Click
Advanced system settingsβComputer Nametab β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
OKthrough confirmation prompts β ClickRestart Now - On login screen β Select
Other user - Enter AD user credentials (e.g.,
ad.lab\john) β PressEnter - Open PowerShell β Run
whoamito 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 2019as the Domain Controller Β - TwoWindows 10 EnterpriseVMs 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.