DNS Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leigh

    #1

    DNS Server

    Hi,
    Is it possible to interface with the DNS Server to create and delete
    records? I trying to create a utility that will create (A) Host records
    automatically. Any information, help or examples would be greatly received.

    Regards, Leigh


  • Leigh

    #2
    Re: DNS Server

    Anybody, anything !?

    Desperate, Leigh

    "Leigh" <someone@ somewhere> wrote in message
    news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > Hi,
    > Is it possible to interface with the DNS Server to create and delete
    > records? I trying to create a utility that will create (A) Host records
    > automatically. Any information, help or examples would be greatly[/color]
    received.[color=blue]
    >
    > Regards, Leigh
    >
    >[/color]


    Comment

    • William Stacey

      #3
      Re: DNS Server

      yes. One way is to use a tool like nsupdate.exe and start that in a
      process and get the return codes. To do it with code, I would use WMI. Has
      all the methods for createzone, add rrs, (etc.), and you can do it with with
      the system.manageme nt classes. Get and use the WMITools on the ms site, and
      the dnsprov.dll in the w2k resource kit or on the ftp site. The wmitools
      really help figure out what methods are in each class and how to call them
      and what they return, etc. If you just need to create A records, I could
      send you an example in c# if you like.

      --
      William Stacey, DNS MVP

      "Leigh" <someone@ somewhere> wrote in message
      news:u8XLmaXeDH A.3204@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Anybody, anything !?
      >
      > Desperate, Leigh
      >
      > "Leigh" <someone@ somewhere> wrote in message
      > news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..[color=green]
      > > Hi,
      > > Is it possible to interface with the DNS Server to create and delete
      > > records? I trying to create a utility that will create (A) Host records
      > > automatically. Any information, help or examples would be greatly[/color]
      > received.[color=green]
      > >
      > > Regards, Leigh
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Leigh

        #4
        Re: DNS Server

        William,
        I would really appreciate it if you would send me an example. please send
        to leigh DOT pointer AT subzero-solutions DOT net

        Thank you, Leigh

        "William Stacey" <staceyw@mvps.o rg> wrote in message
        news:%23feujsbe DHA.2172@TK2MSF TNGP09.phx.gbl. ..[color=blue]
        > yes. One way is to use a tool like nsupdate.exe and start that in a
        > process and get the return codes. To do it with code, I would use WMI.[/color]
        Has[color=blue]
        > all the methods for createzone, add rrs, (etc.), and you can do it with[/color]
        with[color=blue]
        > the system.manageme nt classes. Get and use the WMITools on the ms site,[/color]
        and[color=blue]
        > the dnsprov.dll in the w2k resource kit or on the ftp site. The wmitools
        > really help figure out what methods are in each class and how to call them
        > and what they return, etc. If you just need to create A records, I could
        > send you an example in c# if you like.
        >
        > --
        > William Stacey, DNS MVP
        >
        > "Leigh" <someone@ somewhere> wrote in message
        > news:u8XLmaXeDH A.3204@TK2MSFTN GP11.phx.gbl...[color=green]
        > > Anybody, anything !?
        > >
        > > Desperate, Leigh
        > >
        > > "Leigh" <someone@ somewhere> wrote in message
        > > news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..[color=darkred]
        > > > Hi,
        > > > Is it possible to interface with the DNS Server to create and[/color][/color][/color]
        delete[color=blue][color=green][color=darkred]
        > > > records? I trying to create a utility that will create (A) Host[/color][/color][/color]
        records[color=blue][color=green][color=darkred]
        > > > automatically. Any information, help or examples would be greatly[/color]
        > > received.[color=darkred]
        > > >
        > > > Regards, Leigh
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Scott M.

          #5
          Re: DNS Server

          Leigh,

          It is considered bad Netiquette to request that answers be sent to your
          personal email address.

          Many newsgroup "posters" do not respond to these kinds of requests. Why
          "hog" the answer all for yourself? Maybe some of us would like to see the
          answer as well.


          "Leigh" <someone@ somewhere> wrote in message
          news:e8RtTZgeDH A.620@TK2MSFTNG P11.phx.gbl...[color=blue]
          > William,
          > I would really appreciate it if you would send me an example. please send
          > to leigh DOT pointer AT subzero-solutions DOT net
          >
          > Thank you, Leigh
          >
          > "William Stacey" <staceyw@mvps.o rg> wrote in message
          > news:%23feujsbe DHA.2172@TK2MSF TNGP09.phx.gbl. ..[color=green]
          > > yes. One way is to use a tool like nsupdate.exe and start that in a
          > > process and get the return codes. To do it with code, I would use WMI.[/color]
          > Has[color=green]
          > > all the methods for createzone, add rrs, (etc.), and you can do it with[/color]
          > with[color=green]
          > > the system.manageme nt classes. Get and use the WMITools on the ms site,[/color]
          > and[color=green]
          > > the dnsprov.dll in the w2k resource kit or on the ftp site. The[/color][/color]
          wmitools[color=blue][color=green]
          > > really help figure out what methods are in each class and how to call[/color][/color]
          them[color=blue][color=green]
          > > and what they return, etc. If you just need to create A records, I[/color][/color]
          could[color=blue][color=green]
          > > send you an example in c# if you like.
          > >
          > > --
          > > William Stacey, DNS MVP
          > >
          > > "Leigh" <someone@ somewhere> wrote in message
          > > news:u8XLmaXeDH A.3204@TK2MSFTN GP11.phx.gbl...[color=darkred]
          > > > Anybody, anything !?
          > > >
          > > > Desperate, Leigh
          > > >
          > > > "Leigh" <someone@ somewhere> wrote in message
          > > > news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..
          > > > > Hi,
          > > > > Is it possible to interface with the DNS Server to create and[/color][/color]
          > delete[color=green][color=darkred]
          > > > > records? I trying to create a utility that will create (A) Host[/color][/color]
          > records[color=green][color=darkred]
          > > > > automatically. Any information, help or examples would be greatly
          > > > received.
          > > > >
          > > > > Regards, Leigh
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Rolf Enidsson

            #6
            Re: DNS Server

            If you run your DNS on w2k or w2k3 there are several options.

            If your zone is AD based you can use the System.Director yServices Namespace
            to query or update the DNS directly.

            Another option is to use the DNS Api to manipulate the DNS. look at
            http://msdn.microsoft.com/library/de...asp?frame=true

            And the last option is to use a third party component, capable of doing
            dynamic updates on any DNS.

            "Leigh" <someone@ somewhere> wrote in message
            news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..[color=blue]
            > Hi,
            > Is it possible to interface with the DNS Server to create and delete
            > records? I trying to create a utility that will create (A) Host records
            > automatically. Any information, help or examples would be greatly[/color]
            received.[color=blue]
            >
            > Regards, Leigh
            >
            >[/color]


            Comment

            • William Stacey

              #7
              Re: DNS Server

              Sure:
              public void CreateRR(string zoneName, string rrTextRep)
              {
              if ( zoneName == null )
              throw new ArgumentNullExc eption("zoneNam e", "zoneName is null.");
              if ( rrTextRep == null )
              throw new ArgumentNullExc eption("rrTextR ep", "rrTextRep is null.");

              InvokeMethodOpt ions options = new InvokeMethodOpt ions();
              options.Timeout = new TimeSpan(0,0,0, 5);

              ManagementClass rrClass = new ManagementClass (
              ms,
              new ManagementPath( "MicrosoftDNS_R esourceRecord") ,
              null);

              //Get an input parameters object for this method
              ManagementBaseO bject inParams =
              rrClass.GetMeth odParameters("C reateInstanceFr omTextRepresent ation");

              //Fill in input parameter values
              //inParams["DnsServerN ame"] = null; //Don't need.
              inParams["ContainerN ame"] = zoneName;
              inParams["TextRepresenta tion"] = rrTextRep;

              //Execute the method
              try
              {
              ManagementBaseO bject outObject = rrClass.InvokeM ethod
              ("CreateInstanc eFromTextRepres entation", inParams, null);
              PropertyDataCol lection outProperties = outObject.Prope rties;
              foreach (PropertyData outProperty in outProperties)
              {
              Console.WriteLi ne("Property = " + outProperty.Nam e);
              }
              }
              catch
              {
              throw new ApplicationExce ption("CreateIn stanceFromTextR epresentation
              method failed.");
              }
              } // End CreateInstanceF romTextRepresen tation Method.

              --
              William Stacey, DNS MVP

              "Leigh" <someone@ somewhere> wrote in message
              news:e8RtTZgeDH A.620@TK2MSFTNG P11.phx.gbl...[color=blue]
              > William,
              > I would really appreciate it if you would send me an example. please send
              > to leigh DOT pointer AT subzero-solutions DOT net
              >
              > Thank you, Leigh[/color]
              ....


              Comment

              • Leigh

                #8
                Re: DNS Server

                Scott I understand but[color=blue][color=green]
                >> If you just need to create A records, I could send you an example in c#[/color][/color]
                if you like.
                I assumed William was going to send an example project or class file.

                Leigh

                "Scott M." <s-mar@badspamsnet .net> wrote in message
                news:O9x6iggeDH A.3896@tk2msftn gp13.phx.gbl...[color=blue]
                > Leigh,
                >
                > It is considered bad Netiquette to request that answers be sent to your
                > personal email address.
                >
                > Many newsgroup "posters" do not respond to these kinds of requests. Why
                > "hog" the answer all for yourself? Maybe some of us would like to see the
                > answer as well.
                >
                >
                > "Leigh" <someone@ somewhere> wrote in message
                > news:e8RtTZgeDH A.620@TK2MSFTNG P11.phx.gbl...[color=green]
                > > William,
                > > I would really appreciate it if you would send me an example. please[/color][/color]
                send[color=blue][color=green]
                > > to leigh DOT pointer AT subzero-solutions DOT net
                > >
                > > Thank you, Leigh
                > >
                > > "William Stacey" <staceyw@mvps.o rg> wrote in message
                > > news:%23feujsbe DHA.2172@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
                > > > yes. One way is to use a tool like nsupdate.exe and start that in a
                > > > process and get the return codes. To do it with code, I would use[/color][/color][/color]
                WMI.[color=blue][color=green]
                > > Has[color=darkred]
                > > > all the methods for createzone, add rrs, (etc.), and you can do it[/color][/color][/color]
                with[color=blue][color=green]
                > > with[color=darkred]
                > > > the system.manageme nt classes. Get and use the WMITools on the ms[/color][/color][/color]
                site,[color=blue][color=green]
                > > and[color=darkred]
                > > > the dnsprov.dll in the w2k resource kit or on the ftp site. The[/color][/color]
                > wmitools[color=green][color=darkred]
                > > > really help figure out what methods are in each class and how to call[/color][/color]
                > them[color=green][color=darkred]
                > > > and what they return, etc. If you just need to create A records, I[/color][/color]
                > could[color=green][color=darkred]
                > > > send you an example in c# if you like.
                > > >
                > > > --
                > > > William Stacey, DNS MVP
                > > >
                > > > "Leigh" <someone@ somewhere> wrote in message
                > > > news:u8XLmaXeDH A.3204@TK2MSFTN GP11.phx.gbl...
                > > > > Anybody, anything !?
                > > > >
                > > > > Desperate, Leigh
                > > > >
                > > > > "Leigh" <someone@ somewhere> wrote in message
                > > > > news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..
                > > > > > Hi,
                > > > > > Is it possible to interface with the DNS Server to create and[/color]
                > > delete[color=darkred]
                > > > > > records? I trying to create a utility that will create (A) Host[/color]
                > > records[color=darkred]
                > > > > > automatically. Any information, help or examples would be greatly
                > > > > received.
                > > > > >
                > > > > > Regards, Leigh
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Leigh

                  #9
                  Re: DNS Server

                  Cool, thanks

                  "William Stacey" <staceyw@mvps.o rg> wrote in message
                  news:eDCx3ZheDH A.2464@TK2MSFTN GP09.phx.gbl...[color=blue]
                  > Sure:
                  > public void CreateRR(string zoneName, string rrTextRep)
                  > {
                  > if ( zoneName == null )
                  > throw new ArgumentNullExc eption("zoneNam e", "zoneName is null.");
                  > if ( rrTextRep == null )
                  > throw new ArgumentNullExc eption("rrTextR ep", "rrTextRep is null.");
                  >
                  > InvokeMethodOpt ions options = new InvokeMethodOpt ions();
                  > options.Timeout = new TimeSpan(0,0,0, 5);
                  >
                  > ManagementClass rrClass = new ManagementClass (
                  > ms,
                  > new ManagementPath( "MicrosoftDNS_R esourceRecord") ,
                  > null);
                  >
                  > //Get an input parameters object for this method
                  > ManagementBaseO bject inParams =
                  > rrClass.GetMeth odParameters("C reateInstanceFr omTextRepresent ation");
                  >
                  > //Fill in input parameter values
                  > //inParams["DnsServerN ame"] = null; //Don't need.
                  > inParams["ContainerN ame"] = zoneName;
                  > inParams["TextRepresenta tion"] = rrTextRep;
                  >
                  > //Execute the method
                  > try
                  > {
                  > ManagementBaseO bject outObject = rrClass.InvokeM ethod
                  > ("CreateInstanc eFromTextRepres entation", inParams, null);
                  > PropertyDataCol lection outProperties = outObject.Prope rties;
                  > foreach (PropertyData outProperty in outProperties)
                  > {
                  > Console.WriteLi ne("Property = " + outProperty.Nam e);
                  > }
                  > }
                  > catch
                  > {
                  > throw new ApplicationExce ption("CreateIn stanceFromTextR epresentation
                  > method failed.");
                  > }
                  > } // End CreateInstanceF romTextRepresen tation Method.
                  >
                  > --
                  > William Stacey, DNS MVP
                  >
                  > "Leigh" <someone@ somewhere> wrote in message
                  > news:e8RtTZgeDH A.620@TK2MSFTNG P11.phx.gbl...[color=green]
                  > > William,
                  > > I would really appreciate it if you would send me an example. please[/color][/color]
                  send[color=blue][color=green]
                  > > to leigh DOT pointer AT subzero-solutions DOT net
                  > >
                  > > Thank you, Leigh[/color]
                  > ...
                  >
                  >[/color]


                  Comment

                  • Leigh

                    #10
                    Re: DNS Server

                    Thanks Rolf, very useful

                    "Rolf Enidsson" <rolf.enidsson@ msecf.com> wrote in message
                    news:OxfZ3tgeDH A.3820@tk2msftn gp13.phx.gbl...[color=blue]
                    > If you run your DNS on w2k or w2k3 there are several options.
                    >
                    > If your zone is AD based you can use the System.Director yServices[/color]
                    Namespace[color=blue]
                    > to query or update the DNS directly.
                    >
                    > Another option is to use the DNS Api to manipulate the DNS. look at
                    >[/color]
                    http://msdn.microsoft.com/library/de...asp?frame=true[color=blue]
                    >
                    > And the last option is to use a third party component, capable of doing
                    > dynamic updates on any DNS.
                    >
                    > "Leigh" <someone@ somewhere> wrote in message
                    > news:%23UP96gQe DHA.3616@TK2MSF TNGP11.phx.gbl. ..[color=green]
                    > > Hi,
                    > > Is it possible to interface with the DNS Server to create and delete
                    > > records? I trying to create a utility that will create (A) Host records
                    > > automatically. Any information, help or examples would be greatly[/color]
                    > received.[color=green]
                    > >
                    > > Regards, Leigh
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...