need to modify mx records in 50+ zones, is there a way to script this using DNSCMD?

Posted on 2011-05-12
Last Modified: 2012-05-11
Can someone provide a script that will allow me to modify the cost/weight of 50+ mx records and add 2 additonal mx records to each zone file?

many thanks!

Question by:siber1
    LVL 31

    Accepted Solution

    If you could provide input and output sample.  Second, is it for Linux or Windows?

    Author Comment

    hi farzanj,
    i would like to reference an input text file and list all the zones in there.

    for example:  our primary zone:
    has to mx records:  cost 10  cost 10

    i would like to use the DNSCMD script to first change these costs to 20
    and add (2) new mx records: [we are addding 2 new MTA gateways] cost 10 cost 10

    many thx.

    for /f %a in (zones.txt) do dnscmd . /recordadd %a @ mx 10 smtp

    Open in new window


    Author Closing Comment

    thx anyway

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now