Remote DNS Zone Creation with WMI and VB.NET

V

vbnetdev

Hello All:

This is crossposted to 2 WMI groups as they subject matter is relevant to
their focus. I apologize in advance if it offends anyone.

This code is giving access denied errors ("Access is denied. (Exception from
HRESULT: 0x80070005 (E_ACCESSDENIED))") when attempted to be done from a
remote IP. It works if performed locally. Please advise what permissions
must be changed to allow it to work remotely. IN addition, any attempt to
set the IP address in the parameters fails with a cast error. I am assuming
it is because the IP address property is some sort of collection. I have had
to leave it at 'Nothing' in order to create a zone locally. Then I have to
modify the SOA. If there is a way to set it correctly intiailly that would
be desirable.

Also, where are the other properties? AllowUpdates, Aging and such? I see
the ability to query them in Microsoft_DNS Zone but no methods to set them.

Thank You.

Function TryToWork() As Boolean
Dim connection As New ConnectionOptions
connection.Username = "Username"
connection.Password = "PASSWORD"
connection.Authority = "ntlmdomain:DOMAIN"
' connection.Impersonation = ImpersonationLevel.Impersonate
'connection.EnablePrivileges = True

Dim scope As New ManagementScope( _
"\\" & IPAddress & "\root\MicrosoftDNS", connection)

scope.Connect()

Dim classInstance3 As New ManagementClass( _
CStr(scope.Path.ToString), _
"MicrosoftDNS_Zone", Nothing)

'fails at inParams decaration with access denied error

Dim inParams As ManagementBaseObject = _
classInstance3.GetMethodParameters("CreateZone")
inParams("ZoneName") = ZoneName
inParams("ZoneType") = 0
inParams("DsIntegrated") = True
inParams("DataFileName") = Nothing
inParams("IpAddr") = Nothing
inParams("AdminEmailName") = AdminEmail

Dim outParams As ManagementBaseObject = _
classInstance3.InvokeMethod("CreateZone", inParams, Nothing)

End Function
 
G

Gary Chang[MSFT]

Hi,

We will follow this issue in the microsoft.public.win32.programmer.wmi
newsgroup. If you have any more concerns on it, please check it there.

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 

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

Top