Start Auto-create and conf trials

This commit is contained in:
Alex 2021-04-22 17:26:29 +02:00
parent 0a9f9294e1
commit 4a39822b6d
5 changed files with 26 additions and 35 deletions

View File

@ -17,8 +17,8 @@ $HVName = (Get-NetAdapterAdvancedProperty -name $adapt.name -DisplayName "Hyper-
Rename-Netadapter -name $adapt.name -NewName $HVName
}
echo "Sleeping 30s"
Sleep 30
echo "Sleeping 10s"
Sleep 10
#Général IP configure

View File

@ -18,7 +18,7 @@ Rename-Netadapter -name $adapt.name -NewName $HVName
}
echo "Sleeping 30s"
Sleep 30
Sleep 10
#Général IP configure

View File

@ -18,7 +18,7 @@ Rename-Netadapter -name "$adapt.name" -NewName "$HVName"
}
echo "Sleeping 30s"
Sleep 30
Sleep 10
#Général IP configure

View File

@ -12,14 +12,11 @@ Rename-computer "SRV-1"
# Rename interfaces
$adapts = Get-NetAdapter
foreach ($adapt in $adapts) {
$HVName = (Get-NetAdapterAdvancedProperty -name $adapt.name -DisplayName "Hyper-v Network Adapter Name").DisplayValue
Rename-Netadapter -name $adapt.name -NewName $HVName
}
$HVName = (Get-NetAdapterAdvancedProperty -name "Ethernet" -DisplayName "Hyper-v Network Adapter Name").DisplayValue
Rename-Netadapter -name Ethernet -NewName $HVName
echo "Sleeping 30s"
Sleep 30
Sleep 10
# Set IP for pre-defined MAC addresses
@ -29,7 +26,6 @@ $adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-SRV"}
$IP = "192.168.8.1"
$MaskBits = 24 # This means subnet mask = 255.255.255.0
$Gateway = "192.168.8.254"
$IPType = "IPv4"
$adapter | New-NetIPAddress `
@ -38,15 +34,6 @@ $adapter | New-NetIPAddress `
-PrefixLength $MaskBits `
-DefaultGateway 192.168.8.255
$adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-CLI"}
$IP = "192.168.12.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
# Set DNS
foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('9.9.9.9') }
@ -108,11 +95,11 @@ route add -p 0.0.0.0/0 192.168.8.254
# Change DHCP server options
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -OptionID 3 -Value 192.168.128.254 -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -OptionID 3 -Value 192.168.128.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -OptionID 3 -Value 192.168.12.254 -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -OptionID 3 -Value 192.168.8.254 -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -OptionID 3 -Value 192.168.12.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -DnsServer 9.9.9.9
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -OptionID 3 -Value 192.168.8.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -DnsServer 9.9.9.9
Read-Host "Finished"

View File

@ -19,15 +19,16 @@ $vms = @{
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory SRV-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-01 -ProcessorCount 2
Rename-VMNetworkAdapter -VMName 'SRV-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'SRV-01' -Name "Arc-SRV" -DeviceNaming on
$vmadapter = Get-VMNetworkAdapter -VMName "SRV-01"
Add-VMNetworkAdapter -VMName "SRV-01" -SwitchName "Arc-SRV" -Name "Arc-SRV" -DeviceNaming on
# RTR-01
@ -43,18 +44,19 @@ $vms = @{
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory RTR-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-01 -ProcessorCount 2
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-01"
#Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -Name "Arc-SRV" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'RTR-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'RTR-01' -Name "Arc-SRV" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-01" -SwitchName "Arc-CLI" -Name "Arc-Cli" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-01" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-01" -SwitchName "Arc-SRV" -Name "Arc-SRV" -DeviceNaming on
# RTR-02
@ -70,7 +72,7 @@ $vms = @{
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-02.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
@ -78,11 +80,12 @@ New-VM @vms
Set-VMMemory RTR-02 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-02 -ProcessorCount 2
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-02"
Add-VMNetworkAdapter -VMName "RTR-02" -SwitchName "Bou-LAN" -Name "Bou-LAN" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'RTR-02' -NewName 'Bou-Lan'
Set-VMNetworkAdapter -VMName 'RTR-02' -Name "Bou-LAN" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-02" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
# RTR-03
@ -98,7 +101,7 @@ $vms = @{
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-03.vhdx"
SwitchName = "WAN"
}
New-VM @vms
@ -106,9 +109,10 @@ New-VM @vms
Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-03 -ProcessorCount 2
$vmadapter = Get-VMNetworkAdapter -VMName "RTR-03"
Rename-VMNetworkAdapter -VMName 'RTR-03' -NewName 'WAN'
Set-VMNetworkAdapter -VMName 'RTR-03' -Name "WAN" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-03" -SwitchName "Aston" -Name "Aston" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-03" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
Start-VM -Name RTR*