Last version before end of week.

Need to refactor routing conf (via netsh) and reboots.
This commit is contained in:
Winston Smith 2021-04-23 17:37:49 +02:00
parent 7db3533a5d
commit 44cf01520a
5 changed files with 26 additions and 63 deletions

View File

@ -40,31 +40,16 @@ $IPType = "IPv4"
#Arc-SRV IP conf
$adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-SRV"}
$IP = "192.168.8.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits
netsh interface ip set address name="Arc-SRV" static 192.168.8.254 255.255.255.0
#Arc-CLI conf
$adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-CLI"}
$IP = "192.168.12.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
netsh interface ip set address name="Arc-CLI" static 192.168.12.8 255.255.255.0
### WAN conf
$adapter = Get-NetAdapter | ? {$_.Name -eq "WAN"}
$IP = "192.168.255.8"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
-DefaultGateway "192.168.255.254"
netsh interface ip set address name="WAN" static 192.168.255.8 255.255.255.0`
192.168.255.254
### DNS Conf for all InterfaceAlias ###

View File

@ -34,21 +34,12 @@ $IPType = "IPv4"
#Bou-LAN IP conf
$adapter = Get-NetAdapter | ? {$_.Name -eq "Bou-LAN"}
$IP = "192.168.128.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits
netsh interface ip set address name="Bou-LAN" static 192.168.128.254 255.255.255.0
#WAN
$adapter = Get-NetAdapter | ? {$_.Name -eq "WAN"}
$IP = "192.168.255.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
netsh interface ip set address name="WAN" static 192.168.255.128 255.255.255.0`
192.168.255.254
# END

View File

@ -19,7 +19,7 @@ echo "Renaming Computer"
$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"
Rename-Netadapter -name $adapt.name -NewName $HVName
}
#End
@ -36,18 +36,11 @@ $IPType = "IPv4"
#WAN IP conf
$adapter = Get-NetAdapter | ? {$_.Name -eq "WAN"}
$IP = "192.168.255.254"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits
netsh interface ip set address name="WAN" static 192.168.255.254 255.255.255.0
#Aston
$adapter = Get-NetAdapter | ? {$_.Name -eq "Aston"}
$IP = "192.168.255.254"
$adapter | Set-NetIPInterface -Dhcp Enabled
netsh interface ip set address name="Aston" DHCP
### DNS Conf for all InterfaceAlias
@ -102,4 +95,5 @@ route add -p 192.168.12.0/24 192.168.255.8
route add -p 192.168.128.0/24 192.168.255.128
route add -p 0.0.0.0/0 192.168.255.254
ipconfig /renew
Read-Host "Finished???"

View File

@ -17,8 +17,11 @@ Rename-computer "SRV-1"
### Rename interfaces by parsing VM device name
echo "Renaming adapters"
$HVName = (Get-NetAdapterAdvancedProperty -name "Ethernet" -DisplayName "Hyper-v Network Adapter Name").DisplayValue
Rename-Netadapter -name Ethernet -NewName $HVName
$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
}
#End
# Pausing to let things settle
@ -31,17 +34,8 @@ Sleep 10
#Arc-SRV
$adapter = Get-NetAdapter | ? {$_.Name -eq "Arc-SRV"}
$IP = "192.168.8.1"
$MaskBits = 24 # This means subnet mask = 255.255.255.0
$IPType = "IPv4"
$adapter | New-NetIPAddress `
-AddressFamily $IPType `
-IPAddress $IP `
-PrefixLength $MaskBits `
-DefaultGateway 192.168.8.255
netsh interface ip set address name="Arc-SRV" static 192.168.8.1 255.255.255.0`
192.168.8.255
### DNS Conf for all InterfaceAlias ###

View File

@ -12,8 +12,8 @@ cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\SRV-01.vhdx
Mount-VHD d:\VHD\SRV-01.vhdx
Copy-Item d:\Unattend\SRV-01.xml -Destination e:\Windows\Panther\Unattend.xml
mkdir c:\Scripts
Copy-items d:\Scripts\Guests\SRV-01.ps1
mkdir e:\Tools\Scripts
Copy-item d:\Scripts\Guests\SRV-01.ps1 E:\Tools\scripts
Dismount-VHD d:\VHD\SRV-01.vhdx
$vms = @{
@ -23,7 +23,6 @@ $vms = @{
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
@ -42,8 +41,8 @@ cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\RTR-01.vhdx
Mount-VHD d:\VHD\RTR-01.vhdx
Copy-Item d:\Unattend\RTR-01.xml -Destination e:\Windows\Panther\Unattend.xml
mkdir c:\Scripts
Copy-items d:\Scripts\Guests\RTR-01.ps1
mkdir e:\Tools\Scripts
Copy-item d:\Scripts\Guests\RTR-01.ps1 E:\Tools\scripts
Dismount-VHD d:\VHD\RTR-01.vhdx
$vms = @{
@ -74,8 +73,8 @@ cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\RTR-02.vhdx
Mount-VHD d:\VHD\RTR-02.vhdx
Copy-Item d:\Unattend\RTR-02.xml -Destination e:\Windows\Panther\Unattend.xml
mkdir c:\Scripts
Copy-items d:\Scripts\Guests\RTR-02.ps1
mkdir e:\Tools\Scripts
Copy-item D:\scripts\Guests\RTR-02.ps1 E:\Tools\scripts
Dismount-VHD d:\VHD\RTR-02.vhdx
$vms = @{
@ -106,8 +105,8 @@ cp D:\VHD\Base_dif\Base_server_g2.vhdx D:\VHD\RTR-03.vhdx
Mount-VHD d:\VHD\RTR-03.vhdx
Copy-Item d:\Unattend\RTR-03.xml -Destination e:\Windows\Panther\Unattend.xml
mkdir c:\Scripts
Copy-items d:\Scripts\Guests\RTR-03.ps1
mkdir e:\Tools\Scripts
Copy-item d:\Scripts\Guests\RTR-03.ps1 E:\Tools\scripts
Dismount-VHD d:\VHD\RTR-03.vhdx
$vms = @{