Full auto. Added script to unattend.

Todo: Auto add of custom script depending on VM name.
This commit is contained in:
Alex 2021-04-20 12:50:50 +02:00
parent 69302e7112
commit 0dfc636e9c
1 changed files with 20 additions and 0 deletions

View File

@ -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 = @{