How to create Bulk A records

Using a script!

Copy and paste the below, and run it; make modifications as would apply

<#     

    ===========================================================================  

     Created on:       09/15/2020 

     Created by:       Pride Njukia

            Organization:       Space IT 

     Filename:         Add-DNS 

    =========================================================================== 

    .DESCRIPTION 

        Creates DNS A Record and companion PTR Record from CSV 

            *** CSV MUST BE FORMATTED AS BELOW: 

            Computer,IP 

            DNSName,IP 

            DNSName,IP 

#> 

# Set DNS Server and Domain 

$ServerName = “<YourDNSServerName>” 

$DomainName = “<YourDomain.com>” 

Import-Csv C:\Temp\<YourList>.csv | ForEach-Object { 

    # Define variables 

    $Computer = “$($_.Computer).$DomainName” 

    $addr = $_.IP -split “\.” 

    # Create DNS Entries 

    Add-DnsServerResourceRecord -ComputerName $ServerName -ZoneName $DomainName -A -Name “$($_.Computer)” -IPv4Address “$($_.IP)” -CreatePtr -AgeRecord 

}

3 Replies to “How to create Bulk A records”

Leave a Reply

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