DNS WMI Provider

G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

Sure. Here is DeleteZone and DeleteRR I did in c# awhile ago. HTH

public void DeleteZone(string zoneName)
{
//This method Deletes the zone named in zoneName.
//Step 1 - Check input parms:
if ( zoneName == null )
throw new ArgumentNullException("zoneName", "zoneName is null.");

try
{
ObjectQuery oQuery = new System.Management.ObjectQuery("Select * from
MicrosoftDNS_Zone Where ContainerName = '" + zoneName + "'");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(ms,
oQuery);
ManagementObjectCollection zoneCollection = oSearcher.Get();

bool zoneFound = false;
foreach ( ManagementObject zone in zoneCollection )
{
zoneFound = true;
zone.Delete();
break; //Only one zone could match, so break.
}
if ( ! zoneFound )
throw new ZoneNotFoundException();
}
catch(System.Management.ManagementException e)
{
throw new ApplicationException(e.ErrorCode.ToString() + ". " + e.Message);
}
catch(MVPTools.DnsManagement.ZoneNotFoundException)
{
throw new ZoneNotFoundException("Zone not found.");
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
} // End DeleteZone()

public void DeleteRR(string zoneName, string ownerName, string rData)
{
//Step 1 - Check input parms:
if ( zoneName == null )
throw new ArgumentNullException("zoneName", "zoneName is null.");

if ( ownerName == null )
throw new ArgumentNullException("ownerName", "ownerName is null.");

if ( rData == null )
throw new ArgumentNullException("rData", "rData is null.");

//Step 2 - Check for and Get RR object if it exists.
try
{
ManagementObject rr = null;
if ( ! RRExists(zoneName, ownerName, rData, out rr) )
throw new MVPTools.DnsManagement.RRNotFoundException();
if ( rr == null )
throw new RRNotFoundException();
rr.Delete();
}
catch(System.Management.ManagementException e)
{
throw new ApplicationException(e.ErrorCode.ToString() + ". " + e.Message);
}
catch(MVPTools.DnsManagement.RRNotFoundException)
{
throw new RRNotFoundException("RR not found.");
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
} // End DeleteRR()

--
William Stacey, MVP

"m8v316" <m8v316@discussions.microsoft.com> wrote in message
news:5D79FA85-7425-4E89-92E3-4C08B81CD71A@microsoft.com...
> Is it possible to delete a zone or record using WMI?
>
> TechNet has a quite a few easy to understand examples for creating and
enumerating zones and records at:
>
>
http://www.microsoft.com/technet/community/scriptcenter/network/default.mspx
>
> But there is no examples to delete zones or records. Does anyone know how
its done and, better yet, have a simple example?
>
> Thanks.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

dnscmd /?

/zonedelete is one of the numerous options. You can do it in a batch file of
shell to it in VB.

--
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Directory Services
www.readymaids.com - COMPLETE SPAM Protection
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon


"m8v316" <m8v316@discussions.microsoft.com> wrote in message
news:5D79FA85-7425-4E89-92E3-4C08B81CD71A@microsoft.com...
> Is it possible to delete a zone or record using WMI?
>
> TechNet has a quite a few easy to understand examples for creating and
enumerating zones and records at:
>
>
http://www.microsoft.com/technet/community/scriptcenter/network/default.mspx
>
> But there is no examples to delete zones or records. Does anyone know how
its done and, better yet, have a simple example?
>
> Thanks.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

In news:uoR7wQfZEHA.1248@TK2MSFTNGP11.phx.gbl,
William Stacey [MVP] <staceywREMOVE@mvps.org> asked for help and I offered
my suggestions below:
> Sure. Here is DeleteZone and DeleteRR I did in c# awhile ago. HTH
>
> public void DeleteZone(string zoneName)
> {
> //This method Deletes the zone named in zoneName.
> //Step 1 - Check input parms:
> if ( zoneName == null )
> throw new ArgumentNullException("zoneName", "zoneName is null.");
>
> try
> {
> ObjectQuery oQuery = new System.Management.ObjectQuery("Select *
> from MicrosoftDNS_Zone Where ContainerName = '" + zoneName + "'");
> ManagementObjectSearcher oSearcher = new
> ManagementObjectSearcher(ms, oQuery);
> ManagementObjectCollection zoneCollection = oSearcher.Get();
>
> bool zoneFound = false;
> foreach ( ManagementObject zone in zoneCollection )
> {
> zoneFound = true;
> zone.Delete();
> break; //Only one zone could match, so break.
> }
> if ( ! zoneFound )
> throw new ZoneNotFoundException();
> }
> catch(System.Management.ManagementException e)
> {
> throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> e.Message); }
> catch(MVPTools.DnsManagement.ZoneNotFoundException)
> {
> throw new ZoneNotFoundException("Zone not found.");
> }
> catch(Exception e)
> {
> throw new ApplicationException(e.Message);
> }
> } // End DeleteZone()
>
> public void DeleteRR(string zoneName, string ownerName, string rData)
> {
> //Step 1 - Check input parms:
> if ( zoneName == null )
> throw new ArgumentNullException("zoneName", "zoneName is null.");
>
> if ( ownerName == null )
> throw new ArgumentNullException("ownerName", "ownerName is null.");
>
> if ( rData == null )
> throw new ArgumentNullException("rData", "rData is null.");
>
> //Step 2 - Check for and Get RR object if it exists.
> try
> {
> ManagementObject rr = null;
> if ( ! RRExists(zoneName, ownerName, rData, out rr) )
> throw new MVPTools.DnsManagement.RRNotFoundException();
> if ( rr == null )
> throw new RRNotFoundException();
> rr.Delete();
> }
> catch(System.Management.ManagementException e)
> {
> throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> e.Message); }
> catch(MVPTools.DnsManagement.RRNotFoundException)
> {
> throw new RRNotFoundException("RR not found.");
> }
> catch(Exception e)
> {
> throw new ApplicationException(e.Message);
> }
> } // End DeleteRR()
>
>
> "m8v316" <m8v316@discussions.microsoft.com> wrote in message
> news:5D79FA85-7425-4E89-92E3-4C08B81CD71A@microsoft.com...
>> Is it possible to delete a zone or record using WMI?
>>
>> TechNet has a quite a few easy to understand examples for creating
>> and
> enumerating zones and records at:
>>
>>
>
http://www.microsoft.com/technet/community/scriptcenter/network/default.mspx
>>
>> But there is no examples to delete zones or records. Does anyone
>> know how
> its done and, better yet, have a simple example?
>>
>> Thanks.

William and Deji, there was a question asked last week (have to find the
post) on how to create a child zone of an existing zone with DNSCMD.
Apparently from what the poster said, DNSCMD will just create a full FQDN of
the child and parent zone and not make it a child of the parent.

eg. dnscmd will create:
child1.domain.com
child2.domain.com
etc

instead of rather the expected (or desired):
domain.com
child1
child2
etc.

Not sure if you guys saw the post, but if you didn't, appreciate any
comments on it. I didn't respond since I wasn't sure how to get around that.

--
Regards,
Ace

Please direct all replies ONLY to the Microsoft public newsgroups
so all can benefit.

This posting is provided "AS-IS" with no warranties or guarantees
and confers no rights.

Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
Microsoft Windows MVP - Active Directory

HAM AND EGGS: A day's work for a chicken;
A lifetime commitment for a pig.
--
=================================
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

You know, that's interesting. I want to say dnscmd can't do that, but I'd be
lying if I say "I am sure" of that statement. I'd spend some time with
dnscmd and see if I can come up with a categorical statement.

--
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Directory Services
www.readymaids.com - COMPLETE SPAM Protection
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon


"Ace Fekay [MVP]"
<PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
message news:OFNPXXoZEHA.1980@TK2MSFTNGP09.phx.gbl...
> In news:uoR7wQfZEHA.1248@TK2MSFTNGP11.phx.gbl,
> William Stacey [MVP] <staceywREMOVE@mvps.org> asked for help and I offered
> my suggestions below:
> > Sure. Here is DeleteZone and DeleteRR I did in c# awhile ago. HTH
> >
> > public void DeleteZone(string zoneName)
> > {
> > //This method Deletes the zone named in zoneName.
> > //Step 1 - Check input parms:
> > if ( zoneName == null )
> > throw new ArgumentNullException("zoneName", "zoneName is null.");
> >
> > try
> > {
> > ObjectQuery oQuery = new System.Management.ObjectQuery("Select *
> > from MicrosoftDNS_Zone Where ContainerName = '" + zoneName + "'");
> > ManagementObjectSearcher oSearcher = new
> > ManagementObjectSearcher(ms, oQuery);
> > ManagementObjectCollection zoneCollection = oSearcher.Get();
> >
> > bool zoneFound = false;
> > foreach ( ManagementObject zone in zoneCollection )
> > {
> > zoneFound = true;
> > zone.Delete();
> > break; //Only one zone could match, so break.
> > }
> > if ( ! zoneFound )
> > throw new ZoneNotFoundException();
> > }
> > catch(System.Management.ManagementException e)
> > {
> > throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> > e.Message); }
> > catch(MVPTools.DnsManagement.ZoneNotFoundException)
> > {
> > throw new ZoneNotFoundException("Zone not found.");
> > }
> > catch(Exception e)
> > {
> > throw new ApplicationException(e.Message);
> > }
> > } // End DeleteZone()
> >
> > public void DeleteRR(string zoneName, string ownerName, string rData)
> > {
> > //Step 1 - Check input parms:
> > if ( zoneName == null )
> > throw new ArgumentNullException("zoneName", "zoneName is null.");
> >
> > if ( ownerName == null )
> > throw new ArgumentNullException("ownerName", "ownerName is null.");
> >
> > if ( rData == null )
> > throw new ArgumentNullException("rData", "rData is null.");
> >
> > //Step 2 - Check for and Get RR object if it exists.
> > try
> > {
> > ManagementObject rr = null;
> > if ( ! RRExists(zoneName, ownerName, rData, out rr) )
> > throw new MVPTools.DnsManagement.RRNotFoundException();
> > if ( rr == null )
> > throw new RRNotFoundException();
> > rr.Delete();
> > }
> > catch(System.Management.ManagementException e)
> > {
> > throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> > e.Message); }
> > catch(MVPTools.DnsManagement.RRNotFoundException)
> > {
> > throw new RRNotFoundException("RR not found.");
> > }
> > catch(Exception e)
> > {
> > throw new ApplicationException(e.Message);
> > }
> > } // End DeleteRR()
> >
> >
> > "m8v316" <m8v316@discussions.microsoft.com> wrote in message
> > news:5D79FA85-7425-4E89-92E3-4C08B81CD71A@microsoft.com...
> >> Is it possible to delete a zone or record using WMI?
> >>
> >> TechNet has a quite a few easy to understand examples for creating
> >> and
> > enumerating zones and records at:
> >>
> >>
> >
>
http://www.microsoft.com/technet/community/scriptcenter/network/default.mspx
> >>
> >> But there is no examples to delete zones or records. Does anyone
> >> know how
> > its done and, better yet, have a simple example?
> >>
> >> Thanks.
>
> William and Deji, there was a question asked last week (have to find the
> post) on how to create a child zone of an existing zone with DNSCMD.
> Apparently from what the poster said, DNSCMD will just create a full FQDN
of
> the child and parent zone and not make it a child of the parent.
>
> eg. dnscmd will create:
> child1.domain.com
> child2.domain.com
> etc
>
> instead of rather the expected (or desired):
> domain.com
> child1
> child2
> etc.
>
> Not sure if you guys saw the post, but if you didn't, appreciate any
> comments on it. I didn't respond since I wasn't sure how to get around
that.
>
> --
> Regards,
> Ace
>
> Please direct all replies ONLY to the Microsoft public newsgroups
> so all can benefit.
>
> This posting is provided "AS-IS" with no warranties or guarantees
> and confers no rights.
>
> Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> Microsoft Windows MVP - Active Directory
>
> HAM AND EGGS: A day's work for a chicken;
> A lifetime commitment for a pig.
> --
> =================================
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

dnscmd does not seem to have any facility for this. Very strange. Very
strange indeed. I'm going to post this to the other side and see what people
have to say about it.

--
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Directory Services
www.readymaids.com - COMPLETE SPAM Protection
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon


"Deji Akomolafe" <deji@REMOVEPADDINGakomolafedotcom> wrote in message
news:OHnwpRtZEHA.3112@TK2MSFTNGP09.phx.gbl...
> You know, that's interesting. I want to say dnscmd can't do that, but I'd
be
> lying if I say "I am sure" of that statement. I'd spend some time with
> dnscmd and see if I can come up with a categorical statement.
>
> --
> Sincerely,
>
> Dèjì Akómöláfé, MCSE MCSA MCP+I
> Microsoft MVP - Directory Services
> www.readymaids.com - COMPLETE SPAM Protection
> www.akomolafe.com
> Do you now realize that Today is the Tomorrow you were worried about
> Yesterday? -anon
>
>
> "Ace Fekay [MVP]"
> <PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
> message news:OFNPXXoZEHA.1980@TK2MSFTNGP09.phx.gbl...
> > In news:uoR7wQfZEHA.1248@TK2MSFTNGP11.phx.gbl,
> > William Stacey [MVP] <staceywREMOVE@mvps.org> asked for help and I
offered
> > my suggestions below:
> > > Sure. Here is DeleteZone and DeleteRR I did in c# awhile ago. HTH
> > >
> > > public void DeleteZone(string zoneName)
> > > {
> > > //This method Deletes the zone named in zoneName.
> > > //Step 1 - Check input parms:
> > > if ( zoneName == null )
> > > throw new ArgumentNullException("zoneName", "zoneName is null.");
> > >
> > > try
> > > {
> > > ObjectQuery oQuery = new System.Management.ObjectQuery("Select *
> > > from MicrosoftDNS_Zone Where ContainerName = '" + zoneName + "'");
> > > ManagementObjectSearcher oSearcher = new
> > > ManagementObjectSearcher(ms, oQuery);
> > > ManagementObjectCollection zoneCollection = oSearcher.Get();
> > >
> > > bool zoneFound = false;
> > > foreach ( ManagementObject zone in zoneCollection )
> > > {
> > > zoneFound = true;
> > > zone.Delete();
> > > break; //Only one zone could match, so break.
> > > }
> > > if ( ! zoneFound )
> > > throw new ZoneNotFoundException();
> > > }
> > > catch(System.Management.ManagementException e)
> > > {
> > > throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> > > e.Message); }
> > > catch(MVPTools.DnsManagement.ZoneNotFoundException)
> > > {
> > > throw new ZoneNotFoundException("Zone not found.");
> > > }
> > > catch(Exception e)
> > > {
> > > throw new ApplicationException(e.Message);
> > > }
> > > } // End DeleteZone()
> > >
> > > public void DeleteRR(string zoneName, string ownerName, string rData)
> > > {
> > > //Step 1 - Check input parms:
> > > if ( zoneName == null )
> > > throw new ArgumentNullException("zoneName", "zoneName is null.");
> > >
> > > if ( ownerName == null )
> > > throw new ArgumentNullException("ownerName", "ownerName is null.");
> > >
> > > if ( rData == null )
> > > throw new ArgumentNullException("rData", "rData is null.");
> > >
> > > //Step 2 - Check for and Get RR object if it exists.
> > > try
> > > {
> > > ManagementObject rr = null;
> > > if ( ! RRExists(zoneName, ownerName, rData, out rr) )
> > > throw new MVPTools.DnsManagement.RRNotFoundException();
> > > if ( rr == null )
> > > throw new RRNotFoundException();
> > > rr.Delete();
> > > }
> > > catch(System.Management.ManagementException e)
> > > {
> > > throw new ApplicationException(e.ErrorCode.ToString() + ". " +
> > > e.Message); }
> > > catch(MVPTools.DnsManagement.RRNotFoundException)
> > > {
> > > throw new RRNotFoundException("RR not found.");
> > > }
> > > catch(Exception e)
> > > {
> > > throw new ApplicationException(e.Message);
> > > }
> > > } // End DeleteRR()
> > >
> > >
> > > "m8v316" <m8v316@discussions.microsoft.com> wrote in message
> > > news:5D79FA85-7425-4E89-92E3-4C08B81CD71A@microsoft.com...
> > >> Is it possible to delete a zone or record using WMI?
> > >>
> > >> TechNet has a quite a few easy to understand examples for creating
> > >> and
> > > enumerating zones and records at:
> > >>
> > >>
> > >
> >
>
http://www.microsoft.com/technet/community/scriptcenter/network/default.mspx
> > >>
> > >> But there is no examples to delete zones or records. Does anyone
> > >> know how
> > > its done and, better yet, have a simple example?
> > >>
> > >> Thanks.
> >
> > William and Deji, there was a question asked last week (have to find the
> > post) on how to create a child zone of an existing zone with DNSCMD.
> > Apparently from what the poster said, DNSCMD will just create a full
FQDN
> of
> > the child and parent zone and not make it a child of the parent.
> >
> > eg. dnscmd will create:
> > child1.domain.com
> > child2.domain.com
> > etc
> >
> > instead of rather the expected (or desired):
> > domain.com
> > child1
> > child2
> > etc.
> >
> > Not sure if you guys saw the post, but if you didn't, appreciate any
> > comments on it. I didn't respond since I wasn't sure how to get around
> that.
> >
> > --
> > Regards,
> > Ace
> >
> > Please direct all replies ONLY to the Microsoft public newsgroups
> > so all can benefit.
> >
> > This posting is provided "AS-IS" with no warranties or guarantees
> > and confers no rights.
> >
> > Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> > Microsoft Windows MVP - Active Directory
> >
> > HAM AND EGGS: A day's work for a chicken;
> > A lifetime commitment for a pig.
> > --
> > =================================
> >
> >
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

In news:Ov6tEjwZEHA.2296@TK2MSFTNGP10.phx.gbl,
Deji Akomolafe <deji@REMOVEPADDINGakomolafedotcom> asked for help and I
offered my suggestions below:
> dnscmd does not seem to have any facility for this. Very strange. Very
> strange indeed. I'm going to post this to the other side and see what
> people have to say about it.
>

I tried to test it too as well and it couldn't do it. Here was the original
post concerning this:

From: <JohnShaw@discussions.microsoft.com>
Subject: Use dnscmd or script to add subdomain
Date: Tue, 6 Jul 2004 11:13:02 -0700


--
Regards,
Ace

Please direct all replies ONLY to the Microsoft public newsgroups
so all can benefit.

This posting is provided "AS-IS" with no warranties or guarantees
and confers no rights.

Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
Microsoft Windows MVP - Active Directory

HAM AND EGGS: A day's work for a chicken;
A lifetime commitment for a pig.
--
=================================
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

I am not sure if the OP was refering to a delegation or just a subdomain
node off the zone?
1) If Delegation - Just create the NS RR using dnscmd or gui.
2) If Node - DNS gui will allow creation of empty node, but will not save
when you reload the zone because their is no RR defined that would rebuild
the "empty" node. There is no RR that stands for empty node. You create
the subdomain indirectly by creating a RR in that subdomain, for example:
dnscmd /recordadd test.com. www.sub2.test.com. a "192.168.0.1"

Creates the www a record and an empty node (sub2) in the test.com domain.
The node is empty assuming no other rr in that path. If you delete that RR,
the node is deleted also (if last rr in the last rrset) as nothing exists to
"hold" that node.

So in summay, I think the answer he seeks (if I understand the question) is
to use /RecordAdd if using dnscmd. Please advise if I did not understand
the question. Cheers!

--
William Stacey, MVP

"Ace Fekay [MVP]"
<PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
message news:Ot4mpz3ZEHA.716@TK2MSFTNGP11.phx.gbl...
> In news:Ov6tEjwZEHA.2296@TK2MSFTNGP10.phx.gbl,
> Deji Akomolafe <deji@REMOVEPADDINGakomolafedotcom> asked for help and I
> offered my suggestions below:
> > dnscmd does not seem to have any facility for this. Very strange. Very
> > strange indeed. I'm going to post this to the other side and see what
> > people have to say about it.
> >
>
> I tried to test it too as well and it couldn't do it. Here was the
original
> post concerning this:
>
> From: <JohnShaw@discussions.microsoft.com>
> Subject: Use dnscmd or script to add subdomain
> Date: Tue, 6 Jul 2004 11:13:02 -0700
>
>
> --
> Regards,
> Ace
>
> Please direct all replies ONLY to the Microsoft public newsgroups
> so all can benefit.
>
> This posting is provided "AS-IS" with no warranties or guarantees
> and confers no rights.
>
> Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> Microsoft Windows MVP - Active Directory
>
> HAM AND EGGS: A day's work for a chicken;
> A lifetime commitment for a pig.
> --
> =================================
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

2) was the issue, and your response was exactly what I needed.

I work at an asp that hosts multiple software applications, one of these uses SRV records. I have to create sub-domains with several SRV records for multiple clients and could never figure it out.

Thanks for the Help.

"William Stacey [MVP]" wrote:

> I am not sure if the OP was refering to a delegation or just a subdomain
> node off the zone?
> 1) If Delegation - Just create the NS RR using dnscmd or gui.
> 2) If Node - DNS gui will allow creation of empty node, but will not save
> when you reload the zone because their is no RR defined that would rebuild
> the "empty" node. There is no RR that stands for empty node. You create
> the subdomain indirectly by creating a RR in that subdomain, for example:
> dnscmd /recordadd test.com. www.sub2.test.com. a "192.168.0.1"
>
> Creates the www a record and an empty node (sub2) in the test.com domain.
> The node is empty assuming no other rr in that path. If you delete that RR,
> the node is deleted also (if last rr in the last rrset) as nothing exists to
> "hold" that node.
>
> So in summay, I think the answer he seeks (if I understand the question) is
> to use /RecordAdd if using dnscmd. Please advise if I did not understand
> the question. Cheers!
>
> --
> William Stacey, MVP
>
> "Ace Fekay [MVP]"
> <PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
> message news:Ot4mpz3ZEHA.716@TK2MSFTNGP11.phx.gbl...
> > In news:Ov6tEjwZEHA.2296@TK2MSFTNGP10.phx.gbl,
> > Deji Akomolafe <deji@REMOVEPADDINGakomolafedotcom> asked for help and I
> > offered my suggestions below:
> > > dnscmd does not seem to have any facility for this. Very strange. Very
> > > strange indeed. I'm going to post this to the other side and see what
> > > people have to say about it.
> > >
> >
> > I tried to test it too as well and it couldn't do it. Here was the
> original
> > post concerning this:
> >
> > From: <JohnShaw@discussions.microsoft.com>
> > Subject: Use dnscmd or script to add subdomain
> > Date: Tue, 6 Jul 2004 11:13:02 -0700
> >
> >
> > --
> > Regards,
> > Ace
> >
> > Please direct all replies ONLY to the Microsoft public newsgroups
> > so all can benefit.
> >
> > This posting is provided "AS-IS" with no warranties or guarantees
> > and confers no rights.
> >
> > Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> > Microsoft Windows MVP - Active Directory
> >
> > HAM AND EGGS: A day's work for a chicken;
> > A lifetime commitment for a pig.
> > --
> > =================================
> >
> >
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

Thanks William Stacey! This is exactly what I needed.

As a side note, how did you figure out what API's to use for querying and deleting data? Where you able to piece it togethr from the various pages in msdn.microsoft.ocm or was it from another source?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

No problem. I had to figure this out myself recently using rfcs and other
reading and hair pulling. I finally figured out something that maid sense
to me and offer it here for others.
1) Remember www.sub1.test.com is a *Node in the db that also contains on
type A RRSet and one "A" RR (in this example).
2) A Node can contain zero or more RRSets. Empty leaf nodes are not stored
back into db as nothing to save. The GUI will add empty leaf nodes as GUI
sugar to allow easy add of RRs at that node, but node will disappear if no
records added.
3) A RRSet can contain RRs of the same type.
4) Only one RRSet per type can exist in a Node.
5) A RRSet can contain only one RR of that type and RData (i.e. can not
contain two TXT records with rdata "my text" or two IPs the same for A
records)

The logic to add a node/RR goes ~something like this:

bool return = AddRR( www.sub1.test.com., A, 30, "192.168.0.1")

bool AddRR(ownerName, Type, TTL, RData)
{
Node node = db.FindClosestNode(ownerName);
if ( node == null )
{
// node does not exist and was not a delegation, so add the Node,
RRSet, and RR,
// *including any/all empty Nodes *upto the zone name.
// Adding. www.subx.suby.subz.test.com. to test.com should add:
// subz.test.com. node, suby.subz.test.com. node,
subx.suby.subz.test.com. node and www.subx.suby.subz.test.com node.
}
else
{
if ( node.IsDelegation )
return false; // can not add rr to this db as Node is a
delegation.
// Node exists and was not delegation, so try to add rr to node.
RR rr = node.FindRR(Type, RData)
if ( rr != null )
return false; // RR exists.
node.AddRR(Type, TTL, RData);
return true;
}
}

It is a bit more involved then this, but that should give you an idea. For
me, it helps to understand the data structures and implementation a bit.
HTH

--
William Stacey, MVP

"John Shaw" <JohnShaw@discussions.microsoft.com> wrote in message
news:30D0401D-83A8-4C7F-954C-948FB2957770@microsoft.com...
> 2) was the issue, and your response was exactly what I needed.
>
> I work at an asp that hosts multiple software applications, one of these
uses SRV records. I have to create sub-domains with several SRV records for
multiple clients and could never figure it out.
>
> Thanks for the Help.
>
> "William Stacey [MVP]" wrote:
>
> > I am not sure if the OP was refering to a delegation or just a subdomain
> > node off the zone?
> > 1) If Delegation - Just create the NS RR using dnscmd or gui.
> > 2) If Node - DNS gui will allow creation of empty node, but will not
save
> > when you reload the zone because their is no RR defined that would
rebuild
> > the "empty" node. There is no RR that stands for empty node. You
create
> > the subdomain indirectly by creating a RR in that subdomain, for
example:
> > dnscmd /recordadd test.com. www.sub2.test.com. a "192.168.0.1"
> >
> > Creates the www a record and an empty node (sub2) in the test.com
domain.
> > The node is empty assuming no other rr in that path. If you delete that
RR,
> > the node is deleted also (if last rr in the last rrset) as nothing
exists to
> > "hold" that node.
> >
> > So in summay, I think the answer he seeks (if I understand the question)
is
> > to use /RecordAdd if using dnscmd. Please advise if I did not
understand
> > the question. Cheers!
> >
> > --
> > William Stacey, MVP
> >
> > "Ace Fekay [MVP]"
> > <PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
> > message news:Ot4mpz3ZEHA.716@TK2MSFTNGP11.phx.gbl...
> > > In news:Ov6tEjwZEHA.2296@TK2MSFTNGP10.phx.gbl,
> > > Deji Akomolafe <deji@REMOVEPADDINGakomolafedotcom> asked for help and
I
> > > offered my suggestions below:
> > > > dnscmd does not seem to have any facility for this. Very strange.
Very
> > > > strange indeed. I'm going to post this to the other side and see
what
> > > > people have to say about it.
> > > >
> > >
> > > I tried to test it too as well and it couldn't do it. Here was the
> > original
> > > post concerning this:
> > >
> > > From: <JohnShaw@discussions.microsoft.com>
> > > Subject: Use dnscmd or script to add subdomain
> > > Date: Tue, 6 Jul 2004 11:13:02 -0700
> > >
> > >
> > > --
> > > Regards,
> > > Ace
> > >
> > > Please direct all replies ONLY to the Microsoft public newsgroups
> > > so all can benefit.
> > >
> > > This posting is provided "AS-IS" with no warranties or guarantees
> > > and confers no rights.
> > >
> > > Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> > > Microsoft Windows MVP - Active Directory
> > >
> > > HAM AND EGGS: A day's work for a chicken;
> > > A lifetime commitment for a pig.
> > > --
> > > =================================
> > >
> > >
> >
> >
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

In news:eQT7trCaEHA.712@TK2MSFTNGP11.phx.gbl,
William Stacey [MVP] <staceywREMOVE@mvps.org> asked for help and I offered
my suggestions below:
> No problem. I had to figure this out myself recently using rfcs and
> other reading and hair pulling. I finally figured out something that
> made sense to me and offer it here for others.

<snip>

William, that solution was awesome! Glad you were able to help John!

Ace
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

hacking at WMITools and just staring at namespace until I saw what was going
on. Note the w2k3 and w2k have some different APIs signatures for adding
zones, etc. More are close or the same. Cheers!

--
William Stacey, MVP

"m8v316" <m8v316@discussions.microsoft.com> wrote in message
news:094BF773-C6FD-4F2D-87A6-FCE025E9EA20@microsoft.com...
> Thanks William Stacey! This is exactly what I needed.
>
> As a side note, how did you figure out what API's to use for querying and
deleting data? Where you able to piece it togethr from the various pages in
msdn.microsoft.ocm or was it from another source?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

Thanks Ace. Cheers!

--
William Stacey, MVP
....
>
> William, that solution was awesome! Glad you were able to help John!
>
> Ace
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.dns (More info?)

Now, that IS clever :) Thanks, William.

--
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Directory Services
www.readymaids.com - COMPLETE SPAM Protection
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon


"William Stacey [MVP]" <staceywREMOVE@mvps.org> wrote in message
news:erDqlJCaEHA.3524@TK2MSFTNGP12.phx.gbl...
> I am not sure if the OP was refering to a delegation or just a subdomain
> node off the zone?
> 1) If Delegation - Just create the NS RR using dnscmd or gui.
> 2) If Node - DNS gui will allow creation of empty node, but will not save
> when you reload the zone because their is no RR defined that would rebuild
> the "empty" node. There is no RR that stands for empty node. You create
> the subdomain indirectly by creating a RR in that subdomain, for example:
> dnscmd /recordadd test.com. www.sub2.test.com. a "192.168.0.1"
>
> Creates the www a record and an empty node (sub2) in the test.com domain.
> The node is empty assuming no other rr in that path. If you delete that
RR,
> the node is deleted also (if last rr in the last rrset) as nothing exists
to
> "hold" that node.
>
> So in summay, I think the answer he seeks (if I understand the question)
is
> to use /RecordAdd if using dnscmd. Please advise if I did not understand
> the question. Cheers!
>
> --
> William Stacey, MVP
>
> "Ace Fekay [MVP]"
> <PleaseSubstituteMyActualFirstName&LastNameHere@hotmail.com> wrote in
> message news:Ot4mpz3ZEHA.716@TK2MSFTNGP11.phx.gbl...
> > In news:Ov6tEjwZEHA.2296@TK2MSFTNGP10.phx.gbl,
> > Deji Akomolafe <deji@REMOVEPADDINGakomolafedotcom> asked for help and I
> > offered my suggestions below:
> > > dnscmd does not seem to have any facility for this. Very strange. Very
> > > strange indeed. I'm going to post this to the other side and see what
> > > people have to say about it.
> > >
> >
> > I tried to test it too as well and it couldn't do it. Here was the
> original
> > post concerning this:
> >
> > From: <JohnShaw@discussions.microsoft.com>
> > Subject: Use dnscmd or script to add subdomain
> > Date: Tue, 6 Jul 2004 11:13:02 -0700
> >
> >
> > --
> > Regards,
> > Ace
> >
> > Please direct all replies ONLY to the Microsoft public newsgroups
> > so all can benefit.
> >
> > This posting is provided "AS-IS" with no warranties or guarantees
> > and confers no rights.
> >
> > Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT, MVP
> > Microsoft Windows MVP - Active Directory
> >
> > HAM AND EGGS: A day's work for a chicken;
> > A lifetime commitment for a pig.
> > --
> > =================================
> >
> >
>