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 ConnectionOptio ns
connection.User name = "Username"
connection.Pass word = "PASSWORD"
connection.Auth ority = "ntlmdomain:DOM AIN"
' connection.Impe rsonation = ImpersonationLe vel.Impersonate
'connection.Ena blePrivileges = True
Dim scope As New ManagementScope ( _
"\\" & IPAddress & "\root\Microsof tDNS", connection)
scope.Connect()
Dim classInstance3 As New ManagementClass ( _
CStr(scope.Path .ToString), _
"MicrosoftDNS_Z one", Nothing)
'fails at inParams decaration with access denied error
Dim inParams As ManagementBaseO bject = _
classInstance3. GetMethodParame ters("CreateZon e")
inParams("ZoneN ame") = ZoneName
inParams("ZoneT ype") = 0
inParams("DsInt egrated") = True
inParams("DataF ileName") = Nothing
inParams("IpAdd r") = Nothing
inParams("Admin EmailName") = AdminEmail
Dim outParams As ManagementBaseO bject = _
classInstance3. InvokeMethod("C reateZone", inParams, Nothing)
End Function
--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com