# Made by Alexandre SIMAO # GPLv3 # Script to install and configure a Fuckdows Server 2016 as a router # RTR-01 Only # Script done # Change the poor machine name echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" Rename-computer RTR-03 $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 } #Général IP configure $MaskBits = 24 # This means subnet mask = 255.255.255.0 $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 #Aston $adapter = Get-NetAdapter | ? {$_.Name -eq "Aston"} $IP = "192.168.255.254" $adapter | Set-NetIPInterface -Dhcp Enabled #DNS Conf for all InterfaceAlias foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('9.9.9.9') } # Install Routing and necessary linked roles Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools #Install VPN echo "Install-remoteAccess -VpnType Vpn" Install-remoteAccess -VpnType Vpn Set-NetConnectionProfile -NetworkCategory Private $Params = @{ "Name" = 'vm-monitoring-icmpv4' "Action" = 'Allow' } Set-NetFirewallRule @Params set-service RemoteAccess -StartupType Automatic Start-Service RemoteAccess netsh -f ./WAN.conf Set-NetConnectionProfile -networkcategory private # Change ZoneAlarm rule to accept incoming ICMP ipv4 probes $Params = @{ "Name" = 'vm-monitoring-icmpv4' "Action" = 'Allow' } Set-NetFirewallRule @Params # Add routes route add -p 192.168.8.0/24 192.168.255.8 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 Read-Host "Finished???"