Hi,
Please try the below script.
$file = "C:\temp\records.csv"
Import-Csv -Path $file | ForEach-Object {
if ($_.RecordType -eq "A") {
Add-DnsServerResourceRecordA -ZoneName $_.Zone -IPv4Address $_."IP Address" -Name $_.Name
}
elseif ($_.RecordType -eq "CNAME"){
Add-DnsServerResourceRecordCName -ZoneName $_.Zone -HostNameAlias $_.RecordData -Name $_.Name
}
}
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.