WMI and Create Host(A) Record

V

vbnetdev

This code does not work. I would appreciate any suggestions. I have to
specify a domain name that is not even in its container otherwise it objects
with errors abotu the method being invalid at GetMethodParameters. I have
been able to create the zone and nameservers using similar methods without a
problem. I am beginning to wonder if it is even possible.

Dim classInstance20 As New ManagementObject( _
"root\MicrosoftDNS", _
"MicrosoftDNS_AType.ContainerName='existingdomain.com',DnsServerName='server.DOMAIN.ds',DomainName='existingdomain.com',OwnerName='www.existingdomain.com',RecordClass='1',RecordData='10.10.10.10'",
_
Nothing)

' Obtain [in] parameters for the method
Dim inParamsAREC As ManagementBaseObject = _
classInstance20.GetMethodParameters("CreateInstanceFromPropertyData")
' Add the input parameters.
inParamsAREC("ContainerName") = "abcd.com"
inParamsAREC("DnsServerName") = "server.DOMAIN.ds"
inParamsAREC("IPAddress") = "10.10.10.10"
inParamsAREC("OwnerName") = "www"
inParamsAREC("RecordClass") = 1
inParamsAREC("TTL") = 0
' Execute the method and obtain the return values.
Dim outParamsAREC As ManagementBaseObject = _
classInstance.InvokeMethod("CreateInstanceFromPropertyData",
inParamsAREC, Nothing)
ASPNET_MsgBox("INVALID METHOD HERE")
 
V

vbnetdev

I figured it out. I referred to teh wrong class.

Does anyone have a code example that shows how to make an entry in the
reverse lookup for the host record created? Assuming reverse lookup zone
already exists. I know when you do it manually through the gui it does it
for you.
 
V

vbnetdev

Creation of the PTR record is fixed.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



vbnetdev said:
I figured it out. I referred to teh wrong class.

Does anyone have a code example that shows how to make an entry in the
reverse lookup for the host record created? Assuming reverse lookup zone
already exists. I know when you do it manually through the gui it does it
for you.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



vbnetdev said:
This code does not work. I would appreciate any suggestions. I have to
specify a domain name that is not even in its container otherwise it
objects with errors abotu the method being invalid at
GetMethodParameters. I have been able to create the zone and nameservers
using similar methods without a problem. I am beginning to wonder if it
is even possible.

Dim classInstance20 As New ManagementObject( _
"root\MicrosoftDNS", _

"MicrosoftDNS_AType.ContainerName='existingdomain.com',DnsServerName='server.DOMAIN.ds',DomainName='existingdomain.com',OwnerName='www.existingdomain.com',RecordClass='1',RecordData='10.10.10.10'",
_
Nothing)

' Obtain [in] parameters for the method
Dim inParamsAREC As ManagementBaseObject = _

classInstance20.GetMethodParameters("CreateInstanceFromPropertyData")
' Add the input parameters.
inParamsAREC("ContainerName") = "abcd.com"
inParamsAREC("DnsServerName") = "server.DOMAIN.ds"
inParamsAREC("IPAddress") = "10.10.10.10"
inParamsAREC("OwnerName") = "www"
inParamsAREC("RecordClass") = 1
inParamsAREC("TTL") = 0
' Execute the method and obtain the return values.
Dim outParamsAREC As ManagementBaseObject = _

classInstance.InvokeMethod("CreateInstanceFromPropertyData",
inParamsAREC, Nothing)
ASPNET_MsgBox("INVALID METHOD HERE")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top