# Alexandre Simao # GPL v3 # SRV-02 ONLY # asrc.local domain # TODO: Delegation echo "Shamefully made by Alexandre Simao. Pardon-me M. Stallman" ### Rename this piece of garbage echo "Changing Computer's name" Rename-computer "SRV-02" # 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="Arc-SRV" static 192.168.8.2 255.255.255.0 192.168.8.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,192.168.128.1') } ### Install the DHCP role (Management tools if you love Metrosexual UI) echo "Installing DHCP role" Install-WindowsFeature DHCP -IncludeManagementTools #END ### 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 Read-Host "Finished?" Restart-Computer