Feat: Add SRV-02

This commit is contained in:
Alexandre-Simao 2021-05-31 14:34:24 +02:00
parent 54dc819675
commit 42db1e9fd1
2 changed files with 60 additions and 4 deletions

View File

@ -39,7 +39,7 @@ netsh interface ip set address name="Arc-SRV" static 192.168.8.1 255.255.255.0 1
### 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 ('9.9.9.9') }
foreach ($c in Get-NetAdapter) { write-host 'Setting DNS for' $c.interfaceName ; Set-DnsClientServerAddress -InterfaceIndex $c.interfaceindex -ServerAddresses ('192.168.8.1') }
### Install the DHCP role (Management tools if you love Metrosexual UI)
@ -118,9 +118,7 @@ echo "Adding DHCP server options"
Set-DhcpServerv4OptionValue -ScopeId 192.168.128.0 -Router 192.168.128.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.12.0 -Router 192.168.12.254
Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -Router 192.168.8.254
#Set-DhcpServerv4OptionValue -ScopeId 192.168.8.0 -DnsServer 9.9.9.9
Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 9.9.9.9
Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.8.1
Read-Host "Finished?"
Restart-Computer

View File

@ -34,6 +34,64 @@ echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'SRV-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'SRV-01' -Name "Arc-SRV" -DeviceNaming on
### Adding SRV-02
echo "Adding and configuring SRV-02"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\SRV-02.vhdx
Mount-VHD d:\VHD\SRV-02.vhdx
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination e:\Windows\Panther\Unattend.xml
Copy-Item D:\Scripts\deploy.cmd -Destination e:\conf\deploy.cmd
mkdir e:\Tools\Scripts
Copy-item d:\Scripts\Guests\SRV-02.ps1 E:\Tools\scripts\boot.ps1
Dismount-VHD d:\VHD\SRV-02.vhdx
$vms = @{
Name = "SRV-02"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-02.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory SRV-02 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-02 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'SRV-02' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'SRV-02' -Name "Arc-SRV" -DeviceNaming on
### Adding SRV-03
echo "Adding and configuring SRV-03"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\SRV-03.vhdx
Mount-VHD d:\VHD\SRV-03.vhdx |Get-Disk
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination e:\Windows\Panther\Unattend.xml
Copy-Item D:\Scripts\deploy.cmd -Destination e:\conf\deploy.cmd
mkdir e:\Tools\Scripts
#Copy-item d:\Scripts\Guests\SRV-03.ps1 E:\Tools\scripts\boot.ps1
Dismount-VHD d:\VHD\SRV-03.vhdx
$vms = @{
Name = "SRV-03"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-03.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory SRV-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-03 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'SRV-03' -NewName 'Bou-LAN'
Set-VMNetworkAdapter -VMName 'SRV-03' -Name "Bou-Lan" -DeviceNaming on
### Adding and configuring RTR-01