How to Automate Static DNS A Records with Powershell / PowerCLI – VirtuallyThatGuy

Welcome to VirtuallyThatGuy – This post will be looking at automation the creation of static DNS records in AD using a CSV.

 

Create a csv with below headers​​ 

 

Create a .ps1 file with below script content​​ 

 

Set-ExecutionPolicy​​ RemoteSigned​​ -Confirm:$false

import-csv​​ c:\scripts\csv-dns-import.csv​​ |​​ foreach​​ {​​ add-dnsserverresourcerecorda​​ -Name​​ $_.Name​​ -ZoneName​​ $_.ZoneName​​ -AllowUpdateAny​​ -IPv4Address​​ $_.IPv4address​​ -TimeToLive​​ 01:00:00​​ }

 

​​ 

….​​ 

 

On completion all off above will be registered in AD.​​ 

Set-ExecutionPolicy RemoteSigned -Confirm:$false
import-csv c:\scripts\csv-dns-import.csv | foreach { add-dnsserverresourcerecorda -Name $_.Name -ZoneName $_.ZoneName -AllowUpdateAny -IPv4Address $_.IPv4address -TimeToLive 01:00:00 }

You May Also Like

About the Author: VirtuallyThatGuy

Leave a Reply

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