Datacenter Switchover – Updating DNS

As part of a Datacenter switchover, the DNS record of the CAS array in the failed site should be updated to the IP address CAS Array (or server) in the new site.  This will allow AutoDiscover to continue to continue to return the same fqnd of  the RPCClientAccessServer but have it resolve to a different IP address.

As most organisations will script the other steps necessary for a Datacenter switchover it makes sense to script this DNS change too.  This can be done with the Get-WMIObject cmdlet (alias GWMI).  Generally when people use the Get-WMIObject they access classes from the “Root\CIMv2” namespace.  As this is so common it is the default namesapce for Get-WMIObject so generally the -Namespace parameter is ommited.

To access DNS records we need to specify the “Root\MicrosoftDNS” namespace.  ‘A’ resource records can be accessed using the class “MICROSOFTDNS_ATYPE” and a filter can be used to only return the record we want for the CAS Array.

$a = Get-WmiObject -ComputerName DNS01.bret-tech.com 
 -namespace "root\microsoftdns"
 -class MICROSOFTDNS_ATYPE  
 -filter {OwnerName=CASArray.bret-tech.com} 

If the CAS Array has multiple IP addresses then $a will contain more than one object and ForEach will be required to loop through them individually, however as a CAS Array represents a shared IP address there should only be one IP
address.

To change the DNS record we can call the Modify method on this returned object.  This method requires two parameters:  the first the Time to Live or TTL of the record, setting this to $null creates a static entry, the second parameter is the IP address as a string.

$a.modify ($null , "10.20.0.30")

Leave a Reply

Your email address will not be published. Required fields are marked *