Change DNS A records to CName records


  • Hi,

    We have a lot of A records that all point to the same IP (eg, 'test' and 'live' points to 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 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 $ -ZoneName zone.local -HostNameAlias $_.cname -ComputerName DC01}

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


    Wednesday, June 6, 2018 2:22 PM

All replies