From 48aa8d0bc3f741334107c5c3610f821ff9408181 Mon Sep 17 00:00:00 2001 From: Alexandre S Date: Fri, 14 May 2021 12:12:03 +0200 Subject: [PATCH] Feat: S: Boot script from SRV-01 --- Guests/SRV-01.ps1 | 4 +-- Guests/SRV-03.ps1 | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 Guests/SRV-03.ps1 diff --git a/Guests/SRV-01.ps1 b/Guests/SRV-01.ps1 index 8e6006c..47be538 100644 --- a/Guests/SRV-01.ps1 +++ b/Guests/SRV-01.ps1 @@ -4,7 +4,7 @@ # SRV-01 ONLY # Microdown.local domain -# TODO: +# TODO: Set Option 15 echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" @@ -137,7 +137,7 @@ Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.8.1 # Add BGINFO autostart -Copy-Item "c:\Program Files\BGINFO\bginfo.bat" "C:\Users\Administrateur\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" +C:\Program Files\BGINFO\Bginfo64.exe mescouilles2.bgi /all /nolicprompt Read-Host "Finished?" Restart-Computer diff --git a/Guests/SRV-03.ps1 b/Guests/SRV-03.ps1 new file mode 100644 index 0000000..166ada9 --- /dev/null +++ b/Guests/SRV-03.ps1 @@ -0,0 +1,91 @@ +# Alexandre Simao +# GPL v3 + +# SRV-01 ONLY +# Microdown.local domain + +# TODO: + +echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" + +### Rename this piece of garbage + +echo "Changing Computer's name" +Rename-computer "SRV-03" +# End + +### Rename interfaces by parsing VM device name + +echo "Renaming adapters" +$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 + +echo "Sleeping 10s" +Sleep 10 + +### Général IP configure +# echo "IP configuration" + +#Arc-SRV + +netsh interface ip set address name="Bou-LAN" static 192.168.128.1 255.255.255.0 192.168.128.254 + +### DNS Conf for all InterfaceAlias ### + +echo "DNS Conf" +foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('192.168.8.1') } + +### Setting connection as Private + +echo "Setting connection as Private" +Set-NetConnectionProfile -NetworkCategory Private + +### Change ZoneAlarm rule to accept incoming ICMP ipv4 probes + +echo "Allowing ICMPv4 probes" +$Params = @{ + "Name" = 'vm-monitoring-icmpv4' + "Action" = 'Allow' +} + +Set-NetFirewallRule @Params +# END + +### Add routes for RTR-01 + +echo "Add routes for RTR-01" +route add -p 192.168.12.0/24 192.168.128.254 +route add -p 192.168.255.0/24 192.168.128.254 +route add -p 0.0.0.0/0 192.168.128.254 +# END + + +### Installing and configuring DNS role + + +# Install and configure DNS server + +#Install-WindowsFeature -Name DNS -IncludeManagementTools -includeallsubfeature# + +#Add-DnsServerPrimaryZone -NetworkID 192.168.8.0/24 -ZoneFile “192.168.8.1.in-addr.arpa.dns” # Zone secondaire +#Add-DnsServerPrimaryZone -Name "microdown.local" -ZoneFile "microdown.local.dns" +#Add-DnsServerForwarder -IPAddress 9.9.9.9 -PassThru # Forward + +#Add-DnsServerResourceRecordA -Name "SRV-01" -ZoneName "microdown.local" -IPv4Address "192.168.8.1" -TimeToLive 01:00:00 +#Add-DnsServerResourceRecordA -Name "SRV-02" -ZoneName "microdown.local" -IPv4Address "192.168.8.2" -TimeToLive 01:00:00 +#Add-DnsServerResourceRecordA -Name "NAT" -ZoneName "microdown.local" -IPv4Address "192.168.255.254" -TimeToLive 01:00:00 + +#Test-DnsServer -IPAddress 192.168.8.1 -ZoneName "www.darty.fr" #Test + +# Add BGINFO autostart + +C:\Program Files\BGINFO\Bginfo64.exe mescouilles2.bgi /all /nolicprompt + +Read-Host "Finished?" +Restart-Computer