Hello. I'm working on a Windows 2008 Server. I have a Perl script that is programmed to automatically add entries to my Windows DNS server which is on the same box that I'm running the script on. How it works is, I have a web form that I fill out and when I click Submit, it runs the .pl script and calls the .pm file which contains the dnscmd lines. For some reason, I get an error for each dnscmd line which says:

Cmd : dnscmd NS1.mynameserver.com /zoneadd test.com
/Primary /file test.com.dns,
Result : ,
Errorcode : 1280

I have no idea what error code 1280 means. I have researched it, but can't find anything that I feel would apply to my situation. Also, this script worked flawlessly on my Windows 2003 server. Since we moved our DNS to a Windows 2008 server, I need to run the script directly on the 2008 server which has the new DNS setup because the dnscmd won't work to add entries coming from a 2003 going to a 2008 (Windows security policy etc...)

My thoughts about this is that it's not working because dnscmd needs to be ran as an administrator on the 2008 server in order for it to add entries to the DNS server. I say this because when I take one of the lines of my script and run it from an elevated command line, it works and adds the entries. I may be completely off-base with my thoughts about this, but that's what i gather from my observation.

Here are a few of the dnscmd lines from my script for your reference if you need them:

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /zoneadd $ZONENAME /Primary /file $ZONENAME.dns"; $returncode = ExecAndReturn($cmd);

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /recorddelete $ZONENAME @ NS $PRIMARYDNSHOSTNAME. /f"; $returncode = ExecAndReturn($cmd);

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /recordadd $ZONENAME @ SOA $PRIMARYDNSNAME.$HOSTINGDOMAIN. webmaster.$HOSTINGDOMAIN $SOASN 3600 600 1209600 3600"; $returncode = ExecAndReturn($cmd);

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /recordadd $ZONENAME @ NS $PRIMARYDNSNAME.$HOSTINGDOMAIN."; $returncode = ExecAndReturn($cmd);

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /recordadd $ZONENAME @ A $WEBIP"; $returncode = ExecAndReturn($cmd);

$cmd = "dnscmd $PRIMARYDNSHOSTNAME /recordadd $ZONENAME @ NS $SECONDARYDNSNAME.$HOSTINGDOMAIN."; $returncode = ExecAndReturn($cmd);

Please let me know if you need anything else from me. I'm using ActivePerl 5.8.8 build 822. This is the exact same version and configuration that I use on my Windows 2003 server.

Thanks in advance.

In reply to DNSCMD will not work in Perl script by velocitygirl13

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.