none
Change DNS A records to CName records

    Question

  • Hi,

    We have a lot of A records that all point to the same IP (eg, 'test' and 'live' points to 172.16.0.15) and we would like to change them all to cname records.  I have created the A record for the target of the cname (eg, proxy now points to 172.16.0.15). but would like some help in automating the conversion of the A records to the Cname in powershell:

    I would like to read a csv with two columns - name and cname - for each entry in name, delete the a record then create a new cname based on name and cname.

    The only problem I have is how to achieve this - I know how to automate cname record creation from a csv using this:

    Import-Csv d:\crecords.csv | foreach{Add-DnsServerResourceRecordCName -Name $_.name -ZoneName zone.local -HostNameAlias $_.cname -ComputerName DC01}

    But deleting then doing the create is where I am struggling.  Can anyone help?

    Jim.

    Wednesday, June 06, 2018 2:22 PM

All replies