Post

Setting Up Active Directory Lab: Part 2

Security and Pentest Home Lab Environment

Setting Up Active Directory Lab: Part 2

πŸ› οΈ 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

  1. Open Server Manager β†’ Click Manage β†’ Add Roles and Features
  2. Click Next until the Server Roles page
  3. Enable Active Directory Certificate Services β†’ Click Add Features
  4. Click Next until the Role Services page
  5. Enable Certificate Authority β†’ Click Next
  6. Click Install to begin setup
  7. After installation, restart the server: Β Β  - Start β†’ Power β†’ Restart β†’ Click Continue

βš™οΈ Configure Certificate Services

  1. After reboot, open Server Manager
  2. Click the flag icon β†’ Select Configure Active Directory Certificate Services
  3. Click Next
  4. Enable Certification Authority β†’ Click Next
  5. Continue clicking Next until the Confirmation page
  6. Click Configure β†’ Then Close

πŸ‘€ User Configuration

πŸ‘¨β€πŸ’Ό Create Domain Admin

  1. Open Start β†’ Windows Administrative Tools β†’ Active Directory Users and Computers
  2. Right-click your domain (e.g., ad.lab) β†’ New β†’ User
  3. Enter: Β Β  - First Name, Last Name Β Β  - User logon name (e.g., admin.ad)
  4. Set a password β†’ Uncheck all options except Password never expires β†’ Click Next
  5. Expand the domain β†’ Click Users β†’ Double-click Domain Admins
  6. Go to Members β†’ Click Add
  7. Enter the new user’s name β†’ Click Check Names β†’ OK
  8. Click Apply β†’ OK
  9. Sign out β†’ From login screen, select Other user β†’ Log in with the new domain admin credentials

πŸ‘€ Create AD User 1

  1. Open Active Directory Users and Computers
  2. Right-click the domain β†’ New β†’ User
  3. Enter user details
  4. Set a password β†’ Check: Β Β  - User cannot change password Β Β  - Password never expires
  5. 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

  1. Right-click Start β†’ Select Windows PowerShell (Admin)
  2. 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

  1. Open Start β†’ Windows Administrative Tools β†’ Group Policy Management
  2. Expand: Forest β†’ Domains β†’ your domain (e.g., ad.lab)
  3. Right-click the domain β†’ Create a GPO in this domain and link here Β Β  - Name: Disable Protections
  4. 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 to Enabled β†’ Click Apply β†’ OK
  • Double-click Real-time Protection β†’ Edit Turn off real-time protection β†’ Set to Enabled β†’ 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 to Disabled β†’ Apply β†’ OK
  1. Close the editor β†’ Right-click Disable Protections in Group Policy Management β†’ Select Enforced

πŸ”“ Enable Remote Login for Local Admins

  1. Right-click the domain β†’ Create a GPO in this domain and link here Β Β  - Name: Local Admin Remote Login
  2. Right-click Local Admin Remote Login β†’ Edit
  3. Navigate to:Β  Β Β  Computer Configuration β†’ Preferences β†’ Windows Settings β†’ Registry
  4. 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

  1. Right-click the domain β†’ Create a GPO in this domain and link here Β Β  - Name: Enable WinRM Server
  2. 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 to EnabledΒ  Β  - 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 to Enabled β†’ Apply β†’ OK

πŸ–₯️ Enable RDP (Remote Desktop Protocol)

  1. Right-click the domain β†’ Create a GPO in this domain and link here Β Β  - Name: Enable RDP
  2. Right-click Enable RDP β†’ Edit
  3. Navigate to:Β  Β Β  Computer Configuration β†’ Policies β†’ Administrative Templates β†’ Windows Components β†’ Remote Desktop Services β†’ Remote Desktop Session Host β†’ Connections
  4. Edit Allow users to connect remotely using Remote Desktop Services β†’ Set to Enabled β†’ Apply β†’ OK

πŸ” Enable RPC (Remote Procedure Call)

  1. Right-click the domain β†’ Create a GPO in this domain and link here Β Β  - Name: Enable RPC
  2. Right-click Enable RPC β†’ Edit
  3. Navigate to:Β  Β Β  Computer Configuration β†’ Administrative Templates β†’ System β†’ Remote Procedure Call
  4. Edit Enable RPC Endpoint Mapper Client Authentication β†’ Set to Enabled β†’ Apply β†’ OK

πŸ“₯ Enforce Domain Policies

  1. Open Windows PowerShell (Admin)
  2. Run the following command:
1
gpupdate /force

πŸ’» Windows 10 Enterprise VM1 Setup

πŸ’Ώ OS Installation

  1. Select Windows 10 Enterprise VM1 β†’ Click Start
  2. Click Next β†’ Install now
  3. Accept the license β†’ Click Next
  4. Choose: Custom: Install Windows only (advanced)
  5. Select Disk 0 β†’ Click Next
  6. The VM will reboot several times during installation
  7. Select your Region and Keyboard Layout β†’ Click Skip
  8. Choose Domain join instead to create a local account
  9. Enter a username (e.g., John) β†’ Click Next
  10. Set a password β†’ Click Next
  11. Configure Security Questions β†’ Click Next
  12. Disable all features β†’ Click Accept
  13. Select Not now when prompted for additional setup
  14. On the desktop, click Yes to allow internet access

πŸ“¦ Guest Additions Installation

  1. From the VM toolbar:Β  Β Β  - Devices β†’ Remove disk from virtual drive
  2. Then:Β  Β Β  - Devices β†’ Insert Guest Additions CD image
  3. Open File Explorer β†’ Select the mounted disk
  4. Run VBoxWindowsAdditions
  5. Click Next β†’ Next β†’ Install
  6. Choose Reboot now β†’ Click Finish
  7. After reboot, remove the Guest Additions disk
  8. Use Right Ctrl + F to toggle fullscreen mode

🏷️ Adding VM1 to the Domain

  1. Search for This PC β†’ Right-click β†’ Properties
  2. Click Advanced system settings β†’ Computer Name tab β†’ Change
  3. Set a Computer Name (e.g., WIN10-JOHN)
  4. Under Member of, select Domain β†’ Enter: ad.lab
  5. Click More β†’ Set Primary DNS suffix to ad.lab β†’ Click OK
  6. Enter Domain Admin credentials β†’ Click OK
  7. Click OK through confirmation prompts β†’ Click Restart Now
  8. On login screen β†’ Select Other user
  9. Enter AD user credentials (e.g., ad.lab\john) β†’ Press Enter
  10. 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 Β  - Two Windows 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

  1. Select a VM β†’ Click the ☰ (hamburger menu) β†’ Snapshots
  2. Click Take β†’ Enter a descriptive name β†’ Click OK
  3. Repeat for: Β Β  - Windows Server 2019 Β Β  - Windows 10 Enterprise VM1 Β Β  - Windows 10 Enterprise VM2
  4. Return to VM settings via ☰ β†’ Details

πŸ§ͺ Alternative AD Setup

Explore more AD lab variations:

🧨 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.

πŸ‘‰ - Next β†’ Setting Up a Malware Analysis Lab

This post is licensed under CC BY 4.0 by the author.