|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Has anyone got or seen a working example of making DNS modifications (simple deleting and adding of records) through WMI from .NET code.
I have seen a couple of VBScript examples, but would rather do it through VB or C# code if possible? Is it in fact possible? Any help would be much appreciated. thank you |
|
#2
|
||||
|
||||
|
Dunno, don't have any experience with MS DNS really, but once I saw a guy mention commandline tools to manage MS DNS. It'd be a simple thing to execute those commandline tools with the necessary parameters to manage things.
__________________
Send me a private message if you would like me to setup your DNS for you for a price of your choosing. This is the preferred method if your DNS needs to be fixed/setup fast and you don't have the time to bounce messages back and forth on a forum. Also, check out these links: Whois Direct | DNS Crawler | NS Trace | Compare Free DNS Hosts |
|
#3
|
|||
|
|||
|
I've got a complete web-interface build using WMI from .NET to access the DNS (and IIS). What do you need it for?
regards, Steen |
|
#4
|
|||
|
|||
|
Steen, if you could help, it would be great. I have a complete vbscript version that I wrote, to modify dns records, and I wanted to convert it to c# (more just to get up to speed on c#).
Anyways, I have the dns record additions working, but I can't figure out how to delete records. If you know how to do this, please let me know, or point me to a site with some info. THANKS!!!!! |
|
#5
|
|||
|
|||
|
Quote:
Do you know how to select (with query) a ResourceRecord?? Using a ManagementObjectSearcher and getting a ManagementCollection. Run through the collection and delete the record using the Delete method on the ManagementObject class. Did that make any sence to you? /Steen |
|
#6
|
|||
|
|||
|
Yes, I have a wmi based nslookup that I was using in my vbscript that I ported over to c# ...It works great, but the delete does not seem to work ....still working on it. (I should probably just use a gethostbyname, but this works very well) By the way, here is part of the nslookup code...
ManagementScope oMs = new ManagementScope("\\\\" + dnsServer + "\\root\\microsoftdns"); string strQuery = "select recorddata from microsoftdns_" + recType + "type where containername = '" + domain + "' and ownername = '" + strValue + "'"; ObjectQuery oQ = new ObjectQuery(strQuery); ManagementObjectSearcher oS = new ManagementObjectSearcher(oMs, oQ); ManagementObjectCollection oRc = oS.Get(); foreach (ManagementObject oR in oRc) { temp = oR["recorddata"].ToString(); if (temp.Length == 0) { break; } } if (temp == "") { temp = "none"; } return temp; |
|
#7
|
|||
|
|||
|
Quote:
Well, actually you need to do what you've done above, to delete one or more records. foreach (ManagementObject oR in oRc) { oR.Delete(); } That's the way I do it anyway! /Steen |
|
#8
|
|||
|
|||
|
I just figured it out. Instead of using the "select recorddata from microsoftdns.."
I use "select * from microsoftdns..." I was being too specific in my query, so the delete wouldn't work. When I expanded the query to a wildcard, it worked great. Thanks for all your help on this!!! |
|
#9
|
|||
|
|||
|
I need this
I need this to speed up the process of creating accounts PLEASE. Talk to me.....
Quote:
|
|
#10
|
|||
|
|||
|
What help do you need?
Quote:
What kind of speed issues are you looking to resolve. Please feel free to email off line or post back. -- Mike Poulson http://blogs.msdn.com/mpoulson |
|
#11
|
|||
|
|||
|
DNS through WMI in .NET
hi all, i am now facing this problem too.....
i would like to programmatically add new host to the DNS by using WMI (vb.net or c3). So anyone who got this solution, please kindly post here.... thanks |
|
#12
|
|||
|
|||
|
Quote:
Does anyone have a complete interface/class in either VB.NET or C# that will handle all the common DNS tasks (createZone, DeleteZone, CreateARecord, CreateMXRecord, etc, etc)?? I would greatly appreciate it. I would love to just be able to download a working class file. |
![]() |
| Viewing: Dev Shed Forums > System Administration > DNS > DNS through WMI in .NET |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|