Skip to content

Instantly share code, notes, and snippets.

@jakehildreth
Created July 4, 2025 15:23
Show Gist options
  • Save jakehildreth/beb08e5ce20c6f6f2c8ff5e967eb1e0c to your computer and use it in GitHub Desktop.
Save jakehildreth/beb08e5ce20c6f6f2c8ff5e967eb1e0c to your computer and use it in GitHub Desktop.
No description
$labName = 'SmallServer1'
#create an empty lab template and define where the lab XML files and the VMs will be stored
New-LabDefinition -Name $labName -DefaultVirtualizationEngine HyperV
#make the network definition
Add-LabVirtualNetworkDefinition -Name $labName -AddressSpace 192.168.81.0/24
Set-LabInstallationCredential -Username Install -Password Somepass1
#and the domain definition with the domain admin account
Add-LabDomainDefinition -Name test1.net -AdminUser Install -AdminPassword Somepass1
#the first machine is the root domain controller. Everything in $labSources\Tools get copied to the machine's Windows folder
Add-LabMachineDefinition -Name S1DC1 -Memory 512MB -Network $labName -IpAddress 192.168.81.10 `
-DnsServer1 192.168.81.10 -DomainName test1.net -Roles RootDC `
-ToolsPath $labSources\Tools -OperatingSystem 'Windows Server 2022 Datacenter (Desktop Experience)'
#the second just a member server. Everything in $labSources\Tools get copied to the machine's Windows folder
Add-LabMachineDefinition -Name S1Server1 -Memory 512MB -Network $labName -IpAddress 192.168.81.20 `
-DnsServer1 192.168.81.10 -DomainName test1.net -ToolsPath $labSources\Tools `
-OperatingSystem 'Windows Server 2022 Datacenter (Desktop Experience)'
Install-Lab
Show-LabDeploymentSummary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment