Sunday, 2 May 2021

PowerShell Script: Add multiple CNAME records from .CSV File to Windows Server using PowerShell Command.

 PowerShell Script: Add multiple CNAME records from .CSV File to Windows Server using PowerShell Command.


For Singal Entry

Add-DnsServerResourceRecordCName -Name "demo6" -ZoneName abc.local -HostNameAlias "dc12.abc.local"

 

Check the DNS Entry

Get-DnsServerResourceRecord -ZoneName abc.local -RRType CName







For Multiple Entry using .Csv file

File Format






Import-Csv C:\Users\Administrator\Desktop\cname.csv | foreach {Add-DnsServerResourceRecordCName -Name $_.name -ZoneName abc.local -HostNameAlias $_.cname }

 

Get-DnsServerResourceRecord -ZoneName abc.local -RRType CName 






No comments:

Post a Comment