PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Remote DNS Zone Creation with WMI and VB.NET

Reply

Remote DNS Zone Creation with WMI and VB.NET

 
Thread Tools Rate Thread
Old 21-02-2006, 11:18 PM   #1
vbnetdev
Guest
 
Posts: n/a
Default Remote DNS Zone Creation with WMI and VB.NET


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 = "ntlmdomainOMAIN"
' 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

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




  Reply With Quote
Old 22-02-2006, 05:58 AM   #2
Gary Chang[MSFT]
Guest
 
Posts: n/a
Default RE: Remote DNS Zone Creation with WMI and VB.NET

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.
======================================================

  Reply With Quote
Old 18-03-2006, 02:47 AM   #3
Scott
Guest
 
Posts: n/a
Default Re: Remote DNS Zone Creation with WMI and VB.NET

Is the user running the script in the DNS Admin group?


"vbnetdev" <vbnetdev@community.nospam> wrote in message
news:uLVTv0zNGHA.2816@TK2MSFTNGP15.phx.gbl...
> 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 = "ntlmdomainOMAIN"
> ' 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
>
> --
> Get a powerful web, database, application, and email hosting with KJM
> Solutions
> http://www.kjmsolutions.com
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off