The Startup
Published in

The Startup

Building an Active Directory Lab — Part 1A: AutomatedLab

So you’d like to build an Active Directory (AD) lab and have no idea how to get started. I learnt how to build labs manually however this was quite time consuming and didn’t allow much flexibility (which I’ll cover in a future article).

To setup an AD lab today we’ll be leveraging AutomatedLab. AutomatedLab is a provisioning solution that lets you deploy simple and complex labs on HyperV and Azure with simple PowerShell scripts.

  • Windows Server 2012 R2+/Windows 8.1+
  • Administrator Privilege
  • Intel VT-x or AMD/V capable CPU
  • A reasonable amount of RAM (8GB+)
  • Hyper-V

The full list of requirements can be found on their website.

  • Basic understanding of PowerShell
  • Basic understanding of Windows Environments
  • Basic understanding of Hyper-V

Preperation

AutomatedLab requires you to have some ISOs it can use. It initially creates a base image.

  1. Navigate to Windows Evaluation Centre
  2. Download a Windows Server and a Windows 10 image (For the purpose of this article we’ll assume Windows Server 2016 and Windows 10 Pro)

Ok we’re finally ready to install AutomatedLab.

Open an escalated PowerShell Window and execute the following commands:

Install-Module -Name AutomatedLab -AllowClobber
New-LabSourcesFolder

Great now AutomatedLab is installed!

Note: There is a MSI installer however, I’ve encountered several problems with it in the past.

Navigate to D:\Labsources\ISOs and place your ISO files in it.

Next open an elevated PowerShell Window and type in the following command (Ensure the filepath points to the right location for the LabSources folder)

Get-LabAvailableOperatingSystem -Path D:\LabSources

This should return a list of all operating system images found in the ISOs folder.

Install your first AD lab

  1. Open an elevated PowerShell ISE window and copy paste the following lines :
New-LabDefinition -Name GettingStarted -DefaultVirtualizationEngine HyperV

Add-LabMachineDefinition -Name DC1 -Memory 1GB -OperatingSystem 'Windows Server 2016 Datacenter (Desktop Experience)' -Roles RootDC -DomainName contoso.com
Add-LabMachineDefinition -Name Client1 -Memory 1GB -OperatingSystem 'Windows 10 Pro' -DomainName contoso.com

Install-Lab

Show-LabDeploymentSummary

Once you execute the script AutomatedLab will do the following:

  1. Download Sysinternals tools and place them into the LabSources folder.
  2. It will look for an ISO file that contains the specificed OS name. If it can’t find the ISO it will stop at this point.
  3. AL will create a virtual switch
  4. Then it will create base images for each operating system
  5. It will create a Windows Server 2016 root domain controller with the domain name contoso.com
  6. It will also create a Windows 10 Pro client machine connected to the contoso.com domain

Grab a coffee!

  • Once completed open an elevated Hyper-V Manager window and ensure everything is running.
  • Create a checkpoint for each VM before continuing.
  • You’ve succesfully deployed your first AD lab!

Removing the Lab

Open an elevated PowerShell window and execute the following commands:

Get-Lab -List
Import-Lab LabName
Remove-Lab

It should look similar to this:

Concluding Remarks

The next article will go through how to build an AD Lab on Proxmox VE in a more manual fashion including additional VMs.

If you have any feedback I’d love to hear it you can reach out to me on Twitter.

My views are my own and do not reflect my employers

--

--

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +760K followers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store