Resolve SGU-DC02 and SI short names from Sala Inmersiva
This commit is contained in:
1 parent
0dd4c4d629
commit
b9756ad3b2
4 files changed
+129
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Administrative setup for workgroup clients that have no AD DNS suffix.
|
||||
# This narrowly scoped authoritative zone answers only the bare server name;
|
||||
# the normal lci.lasalle.mx zone continues to handle its FQDN.
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Import-Module DnsServer
|
||||
if ($env:COMPUTERNAME -ne 'SGU-DC02') { throw 'Run this setup on SGU-DC02.' }
|
||||
$zone = 'sgu-dc02'
|
||||
$address = '192.168.54.211'
|
||||
$existingZone = Get-DnsServerZone | Where-Object ZoneName -eq $zone
|
||||
if (-not $existingZone) {
|
||||
Add-DnsServerPrimaryZone -Name $zone -ReplicationScope Domain -DynamicUpdate None
|
||||
} elseif (-not $existingZone.IsDsIntegrated -or $existingZone.DynamicUpdate -ne 'None') {
|
||||
throw 'Existing short-name zone needs review.'
|
||||
}
|
||||
$records = @(Get-DnsServerResourceRecord -ZoneName $zone -Name '@' |
|
||||
Where-Object { $_.RecordType -notin @('SOA','NS') })
|
||||
if ($records.Count -gt 0) {
|
||||
if ($records.Count -ne 1 -or $records[0].RecordType -ne 'A' -or
|
||||
$records[0].RecordData.IPv4Address.IPAddressToString -ne $address) {
|
||||
throw 'Existing short-name record differs; refusing to overwrite it.'
|
||||
}
|
||||
} else {
|
||||
Add-DnsServerResourceRecordA -ZoneName $zone -Name '@' -IPv4Address $address -TimeToLive ([TimeSpan]::FromMinutes(5))
|
||||
}
|
||||
Resolve-DnsName "$zone." -Server 127.0.0.1 -Type A -DnsOnly |
|
||||
Select-Object Name,IPAddress
|
||||
Reference in new issue
Block a user