Feat: SRV-01 DNS Beta+Diff Kill

This commit is contained in:
Alexandre-Simao 2021-06-02 10:12:04 +02:00
parent dd0d388334
commit 07425d4de6
7 changed files with 167 additions and 97 deletions

View File

@ -126,12 +126,12 @@ Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.128.1,192
Install-WindowsFeature -Name DNS -IncludeManagementTools -includeallsubfeature
#Create asrbd.local zone
Set-DnsServerPrimaryZone -ComputerName SRV-01 -Name asrbd.local -SecureSecondaries "TransferToSecureServers" -SecondaryServers "192.168.128.1"
Set-DnsServerPrimaryZone -ComputerName SRV-01 -Name "asrbd.local" -SecureSecondaries "TransferToSecureServers" -SecondaryServers "192.168.128.1"
Add-DnsServerPrimaryZone -ResponsiblePerson "bol@loc.ks" -DynamicUpdate None -ZoneFile asrbd.local.dns -Name asrbd.local
Add-DnsServerPrimaryZone -ResponsiblePerson bol@loc.ks -DynamicUpdate None -ZoneFile asrbd.local.dns -Name asrbd.local
#Rename SOA+NS Main Zone
$ns = Get-DnsServerResourceRecord -ZoneName asrbd.local -RRType NS
$ns = Get-DnsServerResourceRecord -ZoneName "asrbd.local" -RRType NS
$nsnew = $ns.Clone()
@ -153,7 +153,7 @@ Set-DnsServerResourceRecord -ZoneName asrbd.local -NewInputObject $soanew -OldIn
Set-DnsServerPrimaryZone -ComputerName SRV-01 -Name asrbd.local -SecureSecondaries "TransferToSecureServers" -SecondaryServers "192.168.128.1"
#Create reverse lookup Zone
Add-DnsServerPrimaryZone -NetworkID "192.168.0.0/24" -Zonefile "168.192.in-addr.arpa.dns"
Add-DnsServerPrimaryZone -NetworkID "192.168.0.0/16" -Zonefile "168.192.in-addr.arpa.dns"
#Rename SOA+NS Reverse
$ns = Get-DnsServerResourceRecord -ZoneName 168.192.in-addr.arpa -RRType NS

View File

@ -1,4 +1,4 @@
Stop-VM CLI* -turnoff
Remove-VM CLI* -Force
del d:\VHD\CLI*
Stop-VM CLI* -turnoff
Remove-VM CLI* -Force
del d:\VHD\CLI*

View File

@ -1,82 +1,82 @@
## Tool to automate VM creation
echo "Shamefully made by Alexandre Simao. Pardon-me dear M. Stallman"
echo "GPLv3"
### Considered as finished. Need improvement VM side.
### Adding CLI-01
echo "Adding and configuring CLI-01"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-01.vhdx
Mount-VHD d:\VHD\CLI-01.vhdx
<<<<<<< HEAD
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
=======
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
>>>>>>> DNS
#mkdir e:\Tools\Scripts
#Copy-item d:\Scripts\Guests\CLI-01.ps1 E:\Tools\scripts
mkdir "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfo.exe "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
Dismount-VHD d:\VHD\CLI-01.vhdx
$vms = @{
Name = "CLI-01"
Generation = '1'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-01.vhdx"
SwitchName = "Arc-CLI"
}
New-VM @vms
Set-VMMemory CLI-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-01 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'CLI-01' -NewName 'Arc-CLI'
### Adding and configuring CLI-03
echo "Adding and configuring CLI-03"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-03.vhdx
Mount-VHD d:\VHD\CLI-03.vhdx
<<<<<<< HEAD
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
=======
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
>>>>>>> DNS
#mkdir e:\Tools\Scripts
#Copy-item d:\Scripts\Guests\CLI-03.ps1 E:\Tools\scripts
mkdir "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfox86.exe "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
Dismount-VHD d:\VHD\CLI-03.vhdx
$vms = @{
Name = "CLI-03"
Generation = '1'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-03.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory CLI-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-03 -ProcessorCount 2
echo "Configuring adapters"
#Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -Name "Bou-LAN" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'CLI-03' -NewName 'Bou-LAN'
### Starting VMS
echo "Starting VMs"
Start-VM -Name CLI*
## Tool to automate VM creation
echo "Shamefully made by Alexandre Simao. Pardon-me dear M. Stallman"
echo "GPLv3"
### Considered as finished. Need improvement VM side.
### Adding CLI-01
echo "Adding and configuring CLI-01"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-01.vhdx
Mount-VHD d:\VHD\CLI-01.vhdx
<<<<<<< HEAD
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
=======
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
>>>>>>> DNS
#mkdir e:\Tools\Scripts
#Copy-item d:\Scripts\Guests\CLI-01.ps1 E:\Tools\scripts
mkdir "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfo.exe "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
Dismount-VHD d:\VHD\CLI-01.vhdx
$vms = @{
Name = "CLI-01"
Generation = '1'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-01.vhdx"
SwitchName = "Arc-CLI"
}
New-VM @vms
Set-VMMemory CLI-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-01 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'CLI-01' -NewName 'Arc-CLI'
### Adding and configuring CLI-03
echo "Adding and configuring CLI-03"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-03.vhdx
Mount-VHD d:\VHD\CLI-03.vhdx
<<<<<<< HEAD
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
=======
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
>>>>>>> DNS
#mkdir e:\Tools\Scripts
#Copy-item d:\Scripts\Guests\CLI-03.ps1 E:\Tools\scripts
mkdir "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfox86.exe "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
Dismount-VHD d:\VHD\CLI-03.vhdx
$vms = @{
Name = "CLI-03"
Generation = '1'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-03.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory CLI-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-03 -ProcessorCount 2
echo "Configuring adapters"
#Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -Name "Bou-LAN" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'CLI-03' -NewName 'Bou-LAN'
### Starting VMS
echo "Starting VMs"
Start-VM -Name CLI*

67
Host/Create-SRV.ps1 Normal file
View File

@ -0,0 +1,67 @@
### Adding SRV-01
echo "Adding and configuring SRV-01"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\SRV-01.vhdx
$Lettre = Mount-VHD -Path "d:\VHD\SRV-01.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\SRV-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\SRV-01.vhdx
$vms = @{
Name = "SRV-01"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory SRV-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-01 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'SRV-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'SRV-01' -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
$Lettre = Mount-VHD -Path "d:\VHD\SRV-03.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
$DriveLetter = $Lettre.DriveLetter
$drive = $DriveLetter + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item d:\Scripts\Guests\SRV-03.ps1 "${Driveletter}:\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
Start-VM -Name SRV*

3
Host/SRV-Kill Normal file
View File

@ -0,0 +1,3 @@
Stop-VM SRV* -turnoff
del d:\VHD\SRV*

View File

@ -1,7 +1,7 @@
Stop-VM RTR* -turnoff
Stop-VM SRV* -turnoff
Remove-VM RTR* -Force
Remove-VM SRV* -Force
del d:\VHD\RTR*
del d:\VHD\SRV*
Stop-VM RTR* -turnoff
Stop-VM SRV* -turnoff
Remove-VM RTR* -Force
Remove-VM SRV* -Force
del d:\VHD\RTR*
del d:\VHD\SRV*