WIP Create-all
This commit is contained in:
parent
4ecb88f578
commit
81abc34894
@ -12,40 +12,31 @@ $switch_name = "Arc-SRV"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$min_mem = 512MB
|
||||
$mac_mem = 2048MB
|
||||
$max_mem = 2048MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring ${vm_name}"
|
||||
cp "${env:BASE_VHD_PATH}${env:BASE_SRV_NAME}" "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:BASE_VHD_PATH$env:BASE_SRV_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path ${env:VHD_PATH}${vm_name}.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = $DriveLetter + ":"
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "${Driveletter}:\conf\deploy.cmd"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "{$Driveletter}:\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\${vm_name}.ps1" "${Driveletter}:\Tools\scripts\boot.ps1"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "{$Driveletter}:\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$vms = @{
|
||||
|
||||
Name = "$vm_name"
|
||||
Generation = "$gen"
|
||||
MemoryStartupBytes = "$mem"
|
||||
VHDPath = "$env:BASE_VHD_PATH$vm_name.vhdx"
|
||||
SwitchName = "$swith_name"
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
|
||||
Set-VMMemory "${vm_name}" -DynamicMemoryEnabled "$true" -MinimumBytes "${min_mem}" -StartupBytes "${mem}" -MaximumBytes "${max_mem}"
|
||||
Set-VM -Name "${vm_name}" -ProcessorCount "${cpus}"
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName '$vm_name' -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName '$vm_name' -Name "$switch_name" -DeviceNaming on
|
||||
|
||||
### Adding SRV-03
|
||||
|
||||
@ -54,39 +45,31 @@ $switch_name = "Arc-SRV"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$min_mem = 512MB
|
||||
$mac_mem = 2048MB
|
||||
$max_mem = 2048MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring ${vm_name}"
|
||||
cp "${env:BASE_VHD_PATH}${env:BASE_SRV_NAMEV}" "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:BASE_VHD_PATH$env:BASE_SRV_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path ${env:VHD_PATH}${vm_name}.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = $DriveLetter + ":"
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "${Driveletter}:\conf\deploy.cmd"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "{$Driveletter}:\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\${vm_name}.ps1" "${Driveletter}:\Tools\scripts\boot.ps1"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "{$Driveletter}:\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$vms = {
|
||||
|
||||
Name = "${vm_name}"
|
||||
Generation = "${gen}"
|
||||
MemoryStartupBytes = "${mem}"
|
||||
VHDPath = "${env:BASE_VHD_PATH}${vm_name}.vhdx"
|
||||
SwitchName = "${swith_name}"
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
Set-VMMemory "${vm_name}" -DynamicMemoryEnabled "$true" -MinimumBytes "${min_mem}" -StartupBytes "${mem}" -MaximumBytes "${max_mem}"
|
||||
Set-VM -Name "${vm_name}" -ProcessorCount "${cpus}"
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName '$vm_name' -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName '$vm_name' -Name "$switch_name" -DeviceNaming on
|
||||
|
||||
### Adding and configuring RTR-01
|
||||
|
||||
@ -95,44 +78,36 @@ $switch_name = "Arc-CLI"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$min_mem = 512MB
|
||||
$mac_mem = 2048MB
|
||||
$max_mem = 2048MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring ${vm_name}"
|
||||
cp "${env:BASE_VHD_PATH}${env:BASE_SRV_NAME}" "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:BASE_VHD_PATH$env:BASE_SRV_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path ${env:VHD_PATH}${vm_name}.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = $DriveLetter + ":"
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "${Driveletter}:\conf\deploy.cmd"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "{$Driveletter}:\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\${vm_name}.ps1" "${Driveletter}:\Tools\scripts\boot.ps1"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "{$Driveletter}:\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$vms = {
|
||||
|
||||
Name = "${vm_name}"
|
||||
Generation = "${gen}"
|
||||
MemoryStartupBytes = "${mem}"
|
||||
VHDPath = "${env:BASE_VHD_PATH}${vm_name}.vhdx"
|
||||
SwitchName = "${swith_name}"
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
Set-VMMemory "${vm_name}" -DynamicMemoryEnabled "$true" -MinimumBytes "${min_mem}" -StartupBytes "${mem}" -MaximumBytes "${max_mem}"
|
||||
Set-VM -Name "${vm_name}" -ProcessorCount "${cpus}"
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "${vm_name}" -SwitchName "${switch_name2}" -Name "Arc-SRV" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "${vm_name}" -SwitchName "$'{switch_name3}" -Name "Bou-LAN" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name2" -Name "Arc-SRV" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$'switch_name3" -Name "Bou-LAN" -DeviceNaming on
|
||||
|
||||
# RTR-02
|
||||
|
||||
@ -145,37 +120,29 @@ $min_mem = 512MB
|
||||
$max_mem = 2048MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring ${vm_name}"
|
||||
cp "${env:BASE_PATH}${env:BASE_SRV_NAME}" "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:BASE_PATH$env:BASE_SRV_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path ${env:VHD_PATH}${vm_name}.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = $DriveLetter + ":"
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "${Driveletter}:\conf\deploy.cmd"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "{$Driveletter}:\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\${vm_name}.ps1" "${Driveletter}:\Tools\scripts\boot.ps1"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "{$Driveletter}:\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$vms = {
|
||||
|
||||
Name = "${vm_name}"
|
||||
Generation = "${gen}"
|
||||
MemoryStartupBytes = "${mem}"
|
||||
VHDPath = "${env:BASE_VHD_PATH}${vm_name}.vhdx"
|
||||
SwitchName = "${swith_name}"
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
Set-VMMemory "${vm_name}" -DynamicMemoryEnabled "$true" -MinimumBytes "${min_mem}" -StartupBytes "${mem}" -MaximumBytes "${max_mem}"
|
||||
Set-VM -Name "${vm_name}" -ProcessorCount "${cpus}"
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "${vm_name}" -SwitchName "${switch_name2}" -Name "${switch_name2}" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name2" -Name "$switch_name2" -DeviceNaming on
|
||||
|
||||
# RTR-03
|
||||
|
||||
@ -188,37 +155,29 @@ $min_mem = 512MB
|
||||
$max_mem = 2048MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring ${vm_name}"
|
||||
cp "${env:SOURCE_PATH}${env:BASE_SRV_NAME}" "${env:VHD_PATH}${vm_name}.vhdx"
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:SOURCE_PATH$env:BASE_SRV_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path "${env:VHD_PATH}${vm_name}.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = $DriveLetter + ":"
|
||||
New-Item -Path ${Driveletter}:\conf\ -Name "Base" -ItemType "directory"
|
||||
Copy-Item ${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml -Destination $Drive\Windows\Panther\Unattend.xml
|
||||
Copy-Item ${env:SCRIPTS_PATH}deploy.cmd -Destination ${Driveletter}:\conf\deploy.cmd
|
||||
mkdir ${Driveletter}:\Tools\Scripts
|
||||
Copy-item ${env:SCRIPTS_PATH}Guests\${vm_name}.ps1 ${Driveletter}:\Tools\scripts\boot.ps1
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "{$Driveletter}:\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "{$Driveletter}:\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD ${env:VHD_PATH}${vm_name}.vhdx
|
||||
Dismount-VHD $env:VHD_PATH$vm_name.vhdx
|
||||
|
||||
$vms = {
|
||||
|
||||
Name = "${vm_name}"
|
||||
Generation = "${gen}"
|
||||
MemoryStartupBytes = "${mem}"
|
||||
VHDPath = "${env:BASE_VHD_PATH}${vm_name}.vhdx"
|
||||
SwitchName = "${swith_name}"
|
||||
}
|
||||
|
||||
New-VM @vms
|
||||
Set-VMMemory "${vm_name}" -DynamicMemoryEnabled "$true" -MinimumBytes "${min_mem}" -StartupBytes "${mem}" -MaximumBytes "${max_mem}"
|
||||
Set-VM -Name "${vm_name}" -ProcessorCount "${cpus}"
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName '${vm_name}' -NewName '${switch_name}'
|
||||
Set-VMNetworkAdapter -VMName '${vm_name}' -Name "${switch_name}" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "${vm_name}" -SwitchName "${switch_name2}" -Name "${switch_name2}" -DeviceNaming on
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName '$switch_name'
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name2" -Name "$switch_name2" -DeviceNaming on
|
||||
|
||||
### Starting VMS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user