This script automates part of a One Zero One series that illustrates how to automate the process of deploying an AD Lab.
It is an interactive script that creates the required Hyper-V virtual machines. If a virtual machine already exists, it is skipped. This is useful if e.g., you would like to keep the Linux router VM but delete and replace all the Windows VMs.
To use this script you must first install Hyper-V and restart, and create two Hyper-V virtual switches. Please see Active Directory Lab Part III: Installation Prerequisites.
This script is published to PowerShell Gallery. Ensure your system is configured for this repository then execute the following in an Administrator PowerShell:
Install-Script ozo-ad-lab-create-vms
ozo-ad-lab-create-vms
-ClientISO <String>
-DCISO <String>
-RouterISO <String>
-ServerISO <String>
-VHDXPath <String>
Parameter | Description |
---|---|
ClientISO |
The path to the [customized] Client ISO. Defaults to $Env:UserProfile\Downloads\AD-Lab-Client.iso . |
DCISO |
The path to the [customized] DC ISO. Defaults to $Env:UserProfile\Downloads\AD-Lab-DC.iso . |
RouterISO |
The path to the [customized] Router ISO. Defaults to $Env:UserProfile\Downloads\AD-Lab-Router.iso . |
ServerISO |
The path to the [customized] Server ISO. Defaults to $Env:UserProfile\Downloads\AD-Lab-Server.iso . |
VHDXPath |
The path for the VHDX files. Defaults to $Env:ProgramData\Microsoft\Windows\Virtual Hard Disks . |
When all customized OZO-AD-Lab-* ISOs are in your Downloads folder and named as described in Active Directory Lab Part II: Customize the Installer ISOs, you can run this script with no parameters:
ozo-ad-lab-create-vms
If your customized installer ISOs are located elsewhere, you can specify their locations using the relevant parameters, e.g,. if the Client and DC ISOs are in C:\Temp
:
$isoPath = (Join-Path -Path $Env:SystemDrive -ChildPath "Temp")
ozo-ad-lab-create-vms -ClientISO "$isoPath\AD-Lab-Client.iso" -DCISO "$isoPath\AD-Lab-DC.iso"
Run this script in an Administrator PowerShell.
Special thanks to my employer, Sonic Healthcare USA, who has supported the growth of my PowerShell skillset and enabled me to contribute portions of my work product to the PowerShell community.