From c3d382ce3680651181eb201a55a59520c27ec785 Mon Sep 17 00:00:00 2001 From: Winston Smith Date: Tue, 20 Apr 2021 12:50:50 +0200 Subject: [PATCH] Full auto. Added script to unattend. Todo: Auto add of custom script depending on VM name. --- Host/Infra-Standard.ps1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Host/Infra-Standard.ps1 b/Host/Infra-Standard.ps1 index 9420efe..954d54a 100644 --- a/Host/Infra-Standard.ps1 +++ b/Host/Infra-Standard.ps1 @@ -1,6 +1,11 @@ ## Tool to automate VM creation $VMName = "SRV-01" +cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\$VMName.vhdx + +Mount-VHD d:\VHD\$VMName.vhdx +Copy-Item d:\Unattend\$VMName.xml -Destination e:\Windows\Panther\Unattend.xml +Dismount-VHD d:\VHD\$VMName.vhdx $vms = @{ @@ -16,6 +21,11 @@ New-VM @vms Set-VMMemory $VMName -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB $VMName = "RTR-01" +cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\$VMName.vhdx + +Mount-VHD d:\VHD\$VMName.vhdx +Copy-Item d:\Unattend\$VMName.xml -Destination e:\Windows\Panther\Unattend.xml +Dismount-VHD d:\VHD\$VMName.vhdx $vms = @{ @@ -34,6 +44,11 @@ Add-VMSwitch -Name "Arc-SRV" -ResourcePoolName "Arc-SRV" Add-VMSwitch -Name "WAN" -ResourcePoolName "WAN" $VMName = "RTR-02" +cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\$VMName.vhdx + +Mount-VHD d:\VHD\$VMName.vhdx +Copy-Item d:\Unattend\$VMName.xml -Destination e:\Windows\Panther\Unattend.xml +Dismount-VHD d:\VHD\$VMName.vhdx $vms = @{ @@ -50,6 +65,11 @@ Set-VMMemory $VMName -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupByt Add-VMSwitch -Name "WAN" -ResourcePoolName "WAN" $VMName = "RTR-03" +cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\$VMName.vhdx + +Mount-VHD d:\VHD\$VMName.vhdx +Copy-Item d:\Unattend\$VMName.xml -Destination e:\Windows\Panther\Unattend.xml +Dismount-VHD d:\VHD\$VMName.vhdx $vms = @{