
AD search error work-around?
If you debug the program, please check if Byte array for GUID is exactly 16
bytes long.
You may pay additional attention to those 'invisible' characters, such as
trailing blank spaces.
--
Peter Wu
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Quote:
>Subject: AD search error work-around?
>Date: Tue, 25 Jun 2002 08:11:58 -0600
>Lines: 47
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.3604.0
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3604.0
>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: 64.215.88.90
>Path: cpmsftngxa08!tkmsftngp01!tkmsftngp09
>Xref: cpmsftngxa08 microsoft.public.dotnet.languages.vb:51392
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb
>Does anyone know how to work around this problem?
>using this function on a live Active directory returns the error -
>An unhandled exception of type 'System.ArgumentException' occurred in
>mscorlib.dll
>Additional information: Byte array for GUID must be exactly 16 bytes long.
>mySearcher.FindAll()
>This only happens on user accounts that were migrated from one domain to
>another using ADMT from ms.
>Is there a way to work around this?
>Here is the complete code,
>I have this same code in C# and get the same error.
>Sub Main()
>Dim entry As New DirectoryServices.DirectoryEntry("LDAP://my.company.com")
>Dim mySearcher As New System.DirectoryServices.DirectorySearcher(entry)
>Dim res As DirectoryServices.SearchResult
>Dim userName As String = "(anr="
>Dim theName As String
>Console.WriteLine("Enter User to view")
>theName = Console.ReadLine()
>userName = userName + theName + ")"
>mySearcher.SizeLimit = 10
>mySearcher.Filter = userName
>For Each res In mySearcher.FindAll()
>Console.WriteLine(res.GetDirectoryEntry.Path)
>Next