引用了System.DirectoryServices.dll,
Private RootPath As String = "OU=TestOU,DC=ittest,DC=com"
Private ADPath As String = "LDAP://10.10.9.230/"
Private ADUser As String = "sunlizhen"
Private ADPasssWord As String = "abc123"
Private Function GetDirectoryObject(ByVal Optional path As String = "") As DirectoryEntry
Dim entry As DirectoryEntry = Nothing
Try
If path = "" Then
entry = New DirectoryEntry(ADPath + RootPath, ADUser, ADPasssWord, AuthenticationTypes.Secure)
Else
entry = New DirectoryEntry(path, ADUser, ADPasssWord, AuthenticationTypes.Secure)
Dim newguid As String = entry.Guid.ToString()
End If
Catch ex As Exception
entry = Nothing
End Try
Return entry
End Function
提示未定义类型“DirectoryEntry”