I'm having poor performance with this code block and looking for some assistance on where to start troubleshooting it.
I pass a GUID such as: 781b2e1bf45c4045a48732b83d
It can take up to 11 seconds to return the DN from this.
From what I understand I'm directly binding to the object, no searching or enumeration.
This is in a lab domain with just a few dozen accounts and few hundred groups.
Public Shared Function GetDNfromGUID(ByVal GUID As String) As String
Dim stopwatch As New Stopwatch
Dim strDNPath As String = ""
Dim strDN As String
strDNPath = "GC://<GUID=" & GUID & ">"
Dim entry As New DirectoryServices.DirectoryEntry(strDNPath)
strDN = entry.Properties("distinguishedName").Value.ToString
Catch ex As Exception
Log.l("Error getting DN using GUID: " & GUID & " from path " & strDNPath, ex)
Log.l1("GetDNfromGUID: " & stopwatch.ElapsedMilliseconds, "StopWatch.log", -3)