From 91200bf00292a0796597949096fe3b18e2ad838f Mon Sep 17 00:00:00 2001 From: Winston Smith Date: Tue, 20 Apr 2021 10:49:35 +0200 Subject: [PATCH] Full auto. Add network renaming --- RTR-01.ps1 | 12 ++++++++++-- RTR-02.ps1 | 11 ++++++++--- RTR-03.ps1 | 7 +++---- SRV-01_DHCP.ps1 | 18 ++++++++---------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/RTR-01.ps1 b/RTR-01.ps1 index d5eb637..9a20bd5 100644 --- a/RTR-01.ps1 +++ b/RTR-01.ps1 @@ -5,8 +5,16 @@ # RTR-01 Only # Change the poor machine name -$name = Read-host "Nouveau nom d'hôte?" -Rename-computer $name + +Read-host "Script for RTR-01" +Read-host "WARNING: Plug-in in this order Arc-SRV, Arc-CLI and WAN" +echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" + +Rename-computer RTR-01 + +Rename-NetAdapter -Name "Ethernet" -NewName "Arc-SRV" +Rename-NetAdapter -Name "Ethernet 2" -NewName "Arc-CLI" +Rename-NetAdapter -Name "Ethernet 3" -NewName "WAN" # Install Routing and necessary linked roles Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools diff --git a/RTR-02.ps1 b/RTR-02.ps1 index 1504932..96e0877 100644 --- a/RTR-02.ps1 +++ b/RTR-02.ps1 @@ -4,10 +4,15 @@ # Script to install and configure a Fuckdows Server 2016 as a router # RTR-02 Only -# Change the poor machine name -$name = Read-host "Nouveau nom d'hôte?" -Rename-computer $name +Read-host "Script for RTR-02" +Read-host "WARNING: Plug-in in this order Bou-LAN and WAN" +echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" +# Change the poor machine name +Rename-computer "RTR-02" + +Rename-NetAdapter -Name "Ethernet" -NewName "Bou-LAN" +Rename-NetAdapter -Name "Ethernet 2" -NewName "WAN" netsh interface ip set address "WAN" static 192.168.255.8 255.255.255.0 192.168.255.254 netsh interface ip set address "Bou-LAN" static 192.168.128.254 255.255.255.0 diff --git a/RTR-03.ps1 b/RTR-03.ps1 index 062f9fb..b59348b 100644 --- a/RTR-03.ps1 +++ b/RTR-03.ps1 @@ -7,11 +7,10 @@ # RTR-03 Only # Change the poor machine name -$name = Read-host "Nouveau nom d'hôte?" -Rename-computer $name - -Set-NetConnectionProfile -NetworkCategory Private +Rename-computer "RTR-03" +Rename-NetAdapter -Name "Ethernet" -NewName "WAN" +Rename-NetAdapter -Name "Ethernet 2" -NewName "Aston" # Install Routing and necessary linked roles Install-WindowsFeature RemoteAccess, RSAT-RemoteAccess-PowerShell, Routing -IncludeManagementTools diff --git a/SRV-01_DHCP.ps1 b/SRV-01_DHCP.ps1 index 24d1f4a..9a8d38e 100644 --- a/SRV-01_DHCP.ps1 +++ b/SRV-01_DHCP.ps1 @@ -2,26 +2,24 @@ # GPL v3 # SRV-01 ONLY +# TODO : exclusion/attribution fields +# Rename interfaces +# #Rename this piece of garbage -$name = Read-host "Nom d'hôte?" -Rename-computer $name +Rename-computer "SRV-1" +Rename-NetAdapter -Name "Ethernet" -NewName "Arc-SRV" # Install the DHCP role (Management tools if you love Metrosexual UI) Install-WindowsFeature DHCP -IncludeManagementTools # Show all the interface via iproute2 - LOL no via a shitty lookalike netsh inter ipv4 show inter - -# Define various variables -$DHCPServerIP = Read-Host "Interface IP served by DHCP?" -$Interface = Read-host "Interface Name?" -$DefGat = Read-Host "Default Gateway?" -$DNS = Read-Host "DNS Server?" +Set-NetConnectionProfile -NetworkCategory Private # Behold the LoserShell "cmdlet" to attribute static IP -New-NetIPAddress -IPAddress $DHCPServerIP -InterfaceAlias "$Interface" ` -DefaultGateway $DefGat -AddressFamily IPv4 -PrefixLength 24 -Set-DnsClientServerAddress -InterfaceAlias "$Interface" -ServerAddresses $DNS +New-NetIPAddress -IPAddress 192.168.8.1 -InterfaceAlias "Arc-SRV" ` -DefaultGateway 192.168. -AddressFamily IPv4 -PrefixLength 24 +Set-DnsClientServerAddress -InterfaceAlias "Arc-SRV" -ServerAddresses 9.9.9.9 # Create DHCP "security" groups netsh dhcp add securitygroups