Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3241640
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:13:20+00:00 2026-05-17T18:13:20+00:00

I can create a new zone, add and delete records for that zone, all

  • 0

I can create a new zone, add and delete records for that zone, all relatively easily using WMI and System.Management, but for the life of me can’t figure out how to delete a zone. It doesn’t appear to be a method in the WMI Documentation:

http://msdn.microsoft.com/en-us/library/ms682123(VS.85).aspx

Any thoughts on how to do this? Trying to keep the DNS server clean when we remove old website customers, but I can only get as good as deleting all the records in a zone.

EDIT: This is on a windows server 2008 R2 machine. And I would be ok with an answer of “don’t use WMI” if there is an alternate solution I can execute from a remote machine and code in c#

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:13:20+00:00Added an answer on May 17, 2026 at 6:13 pm

    You can delete zones in the same manner you would a record.

    internal static bool DeleteZoneFromDns(string ZoneName)
        {
            try
            {
                string Query = "SELECT * FROM MicrosoftDNS_Zone WHERE ContainerName = '" + ZoneName + "'";
                ObjectQuery qry = new ObjectQuery(Query);
                DnsProvider dns = new DnsProvider();
                ManagementObjectSearcher s = new ManagementObjectSearcher(dns.Session, qry);
                ManagementObjectCollection col = s.Get();
                dns.Dispose();
    
                foreach (ManagementObject obj in col)
                {
                    obj.Delete();
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How exactly can I create a new directory using Emacs? What commands do I
You can create new objects, but when you've finished using them there's no real
Is there a hudson plugin to add multi-user functionality ? Users can create new
When I start a new ASP.NET project in Visual Studio, I can create an
To create a new event handler on a control you can do this c.Click
I can create the following and reference it using area[0].states[0] area[0].cities[0] var area =
I have a WinForms application. That application have a rich functionality. It can create
i need some help understanding how i can create a new custom event. i
I am building a visual studio like application: User can create a new project,
If all tables I want to delete from have the column gamer_id can i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.