Automated lab helps in setting up experimental lab environments quickly. The link provides comprehensive guide and several sample scenario scripts are provided to help one get started.
To set up a simple Lab for development purposes the following script can be used.
New-LabDefinition -Name iDynamicsDev -ReferenceDiskSizeInGB 100 -Path ‘C:\iDynamics\Dev’ -DefaultVirtualizationEngine HyperV
Add-LabVirtualNetworkDefinition -Name Lab0
Add-LabVirtualNetworkDefinition -Name ‘Default Switch’ -HyperVProperties @{ SwitchType = ‘Default Switch’; AdapterName = ‘Wi-Fi’ }
Add-LabMachineDefinition -Name DC1 -Memory 2GB -OperatingSystem ‘Windows Server 2016 Datacenter (Desktop Experience)’ -Roles RootDC -Network Lab0 -DomainName idynamics.dev
$netAdapter = @()
$netAdapter += New-LabNetworkAdapterDefinition -VirtualSwitch Lab0
$netAdapter += New-LabNetworkAdapterDefinition -VirtualSwitch ‘Default Switch’ -UseDhcp
Add-LabMachineDefinition -Name Router1 -Memory 2GB -OperatingSystem ‘Windows Server 2016 Datacenter (Desktop Experience)’ -Roles Routing -NetworkAdapter $netAdapter -DomainName idynamics.dev
Add-LabMachineDefinition -Name Client1 -Memory 6GB -Network Lab0 -OperatingSystem ‘Windows Server 2016 Datacenter (Desktop Experience)’ -DomainName idynamics.dev
Install-Lab
Show-LabDeploymentSummary -Detailed
The above script will create three VM’s
- DC1 > Domain controller with domain name idynamics.dev
- Router1 > joined to domain idynamics.dev and having access to internet
- Client1 > joined to domain idynamics.dev but with no internet access.
The definition files are stored as xml files at C:\idynamics\dev and the file Lab.xml will have all information relating to the LabDefinition iDynamicsDev.
The cmdLet Import-Lab -Path C:\idynamics\dev\Lab.xml will indicate how may VM’s are hosted in HyperV
Removing the Lab is done by invoking the cmdLet Remove-Lab
Result of successfully removing the lab:
- C:\AutomatedLab-VMs will have only the base image
- C:\idynamics\dev and the associated config files will be removed