VB.NET Creating A New DNS Record
I've been trying to get this and other code to work for over 2 days now and have not had any luck.
I'm trying to create a new DNS record and am using the following code:
Code:
Dim strWebsite As String = "testing.com"
Dim strRRsufix = ". IN A 71.84.210.248"
Dim strRR As String
Dim strDomain As String = "testing.com"
strRR = strWebsite + strRRsufix
Dim objDNS = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\MicrosoftDNS")
Dim objRR = objDNS.Get("MicrosoftDNS_ResourceRecord")
Dim objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
Dim strNull = objRR.CreateInstanceFromTextRepresentation(objDNSServer.Name, strDomain, strRR)
The error I'm getting is: Bad variable type.
Any help would be greatly appreciated. Also if there is another way you may be doing it please let me knwo.
Thanks again.