L
Leszek Gruszka
I wrote this code:
But somewhere i made a mistake...
Try
Dim objRootDSE = GetObject(LDAP://RootDSE)
Dim strConfigurationNC = objRootDSE.Get("configurationNamingContext")
Dim strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
Dim objSubnetsContainer = GetObject(strSubnetsContainer)
Dim array(0) As String
Dim objsubnet, strSiteObjectDN, strSiteObjectName, strKey
array(0) = "subnet"
objSubnetsContainer.Filter = array
Dim objHash = CreateObject("Scripting.Dictionary")
For Each objsubnet In objSubnetsContainer
objsubnet.GetInfoEx(array("siteObject"), 0)
strSiteObjectDN = objsubnet.Get("siteObject")
strSiteObjectName = Split(Split(strSiteObjectDN, ",")(0), "=")(1)
If objHash.Exists(strSiteObjectName) Then
objHash(strSiteObjectName) = objHash(strSiteObjectName) & "," &
Split(objsubnet.Name, "=")(1)
Else
objHash.Add(strSiteObjectName, Split(objsubnet.Name, "=")(1))
End If
Next
For Each strKey In objHash.Keys
MsgBox(strKey & "," & objHash(strKey))
Next
Catch ex As Exception
System.Console.WriteLine(ex.Message)
End Try
But somewhere i made a mistake...
Try
Dim objRootDSE = GetObject(LDAP://RootDSE)
Dim strConfigurationNC = objRootDSE.Get("configurationNamingContext")
Dim strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
Dim objSubnetsContainer = GetObject(strSubnetsContainer)
Dim array(0) As String
Dim objsubnet, strSiteObjectDN, strSiteObjectName, strKey
array(0) = "subnet"
objSubnetsContainer.Filter = array
Dim objHash = CreateObject("Scripting.Dictionary")
For Each objsubnet In objSubnetsContainer
objsubnet.GetInfoEx(array("siteObject"), 0)
strSiteObjectDN = objsubnet.Get("siteObject")
strSiteObjectName = Split(Split(strSiteObjectDN, ",")(0), "=")(1)
If objHash.Exists(strSiteObjectName) Then
objHash(strSiteObjectName) = objHash(strSiteObjectName) & "," &
Split(objsubnet.Name, "=")(1)
Else
objHash.Add(strSiteObjectName, Split(objsubnet.Name, "=")(1))
End If
Next
For Each strKey In objHash.Keys
MsgBox(strKey & "," & objHash(strKey))
Next
Catch ex As Exception
System.Console.WriteLine(ex.Message)
End Try