Fix: Create-all fix, v1, functionnal!
This commit is contained in:
parent
81abc34894
commit
2da759146b
@ -23,9 +23,9 @@ $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 "${Drive}\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" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
@ -35,8 +35,8 @@ Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -Star
|
||||
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
|
||||
|
||||
@ -56,9 +56,9 @@ $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 "${Drive}\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" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
@ -68,13 +68,55 @@ Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -Star
|
||||
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
|
||||
|
||||
$vm_name = "RTR-01"
|
||||
$switch_name = "Arc-CLI"
|
||||
$switch_name2 = "Arc-SRV"
|
||||
$switch_name3 = "WAN"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$min_mem = 512MB
|
||||
$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"
|
||||
|
||||
$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 "${Drive}\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
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
|
||||
|
||||
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 "WAN" -DeviceNaming on
|
||||
|
||||
# RTR-02
|
||||
|
||||
$vm_name = "RTR-02"
|
||||
$switch_name = "Bou-LAN"
|
||||
$switch_name2 = "WAN"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$min_mem = 512MB
|
||||
@ -89,9 +131,9 @@ $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 "${Drive}\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" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
@ -101,46 +143,7 @@ Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -Star
|
||||
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
|
||||
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
|
||||
|
||||
# RTR-02
|
||||
|
||||
$vm_name = "RTR-02"
|
||||
$switch_name = "Bou-LAN"
|
||||
$switch_name2 = "WAN"
|
||||
$gen = 2
|
||||
$mem = 1024MB
|
||||
$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"
|
||||
|
||||
$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"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
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'
|
||||
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
|
||||
|
||||
@ -156,16 +159,16 @@ $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"
|
||||
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
|
||||
$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 "${Drive}\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" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD $env:VHD_PATH$vm_name.vhdx
|
||||
|
||||
@ -175,7 +178,7 @@ Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -Star
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName '$switch_name'
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user