First, we need to download VirtualBox, VirtualBox Extension pack, Microsoft Server 2022, and Microsoft Windows 10.
Download and Install VirtualBox
Download VirtualBox Guest Additions
Download Windows Server 2022 ISO from Microsoft Evaluation Center
Download Windows 10 ISO from Microsoft
Create a New Virtual Machine (VM)
Open VirtualBox and select "New".
Name the VM (Server22).
Select the Windows Server 2022 ISO.
Allocate resources. This will depend on how much RAM and CPU cores you have available. I suggest at least 4GB of RAM.
Selet size of Virtual Disk. I suggest at least 32GB.
For this project, we are going to use two network adapters for the Server.
Use NAT for adapter 1. This will allow the VM to connect to the internet through the host and automatically receive an IP address.
Add a second network adapter and select "Internal". This adapter will be given a static IP address and will allow our client machine to receive an IP address from a defined range of IP addresses.
Start up the VM and Install Windows Server 2022
Follow the installation prompts.
Select Windows Server 2022 Standard Evaluation (Desktop Experience).
Set up a password for logging into Windows Server. Since this is just a lab, we will use "Password1" for logins.
Install VirtualBox Guest Additions
After installation of Server 2022, insert the Guest Additions CD. Open file explorer, locate CD Drive (D:) VirtualBox Guest Additions and install Guest Additions.
Follow the prompts to install guest additions. Reboot.
Rename network adapters for clarity. Open up properties on each adapter to verify which one is the NAT adapter and which is the Internal adapter. Here we gave the NAT adapter the name "Internet" and the Internal adapter we named "X_Internal_X".
Configure IPv4 settings, ensuring automatic IP for Internet (Internet) adapter and static IP 172.16.0.1. Set the subnet mask as 255.255.255.0 and leave the default gateway empty. For the DNS server, we can use the same static IP (172.16.0.1) or use the loopback address 127.0.0.1 for internal (X_Internal_X) adapter.
Rename the PC as "DC" for easy identification by going to Start > Settings > System > About > Rename This PC. Restart.
Install Active Directory Domain Services (ADDS)
Open Server Manager and click on Add Roles and Features.
Select Role-based, select the server and choose Active Directory Domain Services.
Complete the installation process.
Promote the server to a domain controller, specifying a new forest name mydomain.com.
Create a password for Directory Service Restore Mode (DSRM). Since this is a lab, we can use the same password we used from earlier. Verify NetBIOS name. This should be the same as your domain name. (mydomain). Complete the installation and restart the server.
Create Administrative User - After restart, the login now shows MYDOMAIN\ADMINISTRATOR. Login with the password you created created earlier.
Open Active Directory Users and Computers.
Create a new Organizational Unit named "_Admins".
Add a new user to the _Admins OU.
Add user to Domain Admins group.
Logout out the built-in administrator account. Log back in with the new domain admin account.
Install Routing and Remote Access (RAS/NAT)
Install RAS/NAT through "Add Roles and Features".
Open Server Manager and go to Tools > Routing and Remote Access.
Configure and enable routing and remote access, selecting NAT and specifying the public interface (Internet). Inside of "Routing and Remote Access", you may have to right-click on DC and click refresh to get the interfaces to show or close and re-open Routing and Remote Access.
Set Up DHCP Server - This will allow our client to receive an IP address in the scope that we are going to specify.
Install DHCP Server role through "Add Roles and Features".
In Server Manager, go to Tools > DHCP. Click the drop down arrow next to dc.mydomain.com, right-click IPv4 and select "New Scope".
Name the new scope "172.16.0.100-200" and specify the DHCP scope.
Skip IP Exclusions and leave the lease time as "8 days". Configure Router (Default Gateway) IP Address as 172.16.0.1. Click "Add".
For DNS, leave the parent domain as mydomain.com.
Leave WINS Server blank and click Next. Select "Yes, I want to activate this scope now". Authorize the DHCP server by right-clicking on dc.mydomain.com and select "Authorize". Refresh IPv4.
Bulk User Creation with PowerShell
Open Microsoft Edge browser and navigate to this URL.
Download ZIP.
Open File Explorer and navigate to Downloads. Extract the ZIP file to the Desktop.
Run PowerShell ISE as administrator. Open the script. Use the CD command to to navigate to our extracted folder (cd C:/Users/a-jdoe/Desktop/AD_PS-master). Run the ls command command to display files in this folder. Should see "names.txt".
Run Set-ExecutionPolicy-Unrestricted and answer "yes".
Run the script and answer "Run Once" to the Security Warning prompt.
When the script has finished running, exit out of PowerShell.
Verify user creation in Active Directory Users and Computers.
Create Windows 10 Pro Client VM with the Windows 10 ISO
Create a new VM named "Client1" with appropriate settings.
Change Client1 VM's network adapter to the "Internal" adapter we used for the server/ DC.
Install Windows 10 Pro. Create a local account.
Install VirtualBox Guest Additions and restart the VM
Change the client's DNS server to the IP address of the DC's X_Internal_X adapter.
Open the command prompt and run ipconfig. The client should have received an IP address from the DC.
Rename the PC to "Client1" and join the domain (mydomain.com). Use the administrator credentials to authorize.
Restart the PC and log in with a domain user account.
Starting with setting up VirtualBox and downloading essential software, we progressed through creating and configuring the virtual machine, installing Windows Server 2022, and adding Active Directory Domain Services (ADDS), Routing and Remote Access (RAS/NAT), and a DHCP Server. We finished with bulk user creation using PowerShell and configuring a Windows 10 client machine to join the domain. By following this guide, users can create a robust AD home lab environment, providing hands-on experience essential for mastering Windows Server and Active Directory administration.