Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

Enumerating winNT Users with DirectoryServices

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Williams - 07 Dec 2004 15:33 GMT
Hi

I am using DirectoryServices to find all the members of a
certain NT group and display their properties. The
following code works fine.

DirectoryEntry directory = new DirectoryEntry("WinNT://"
+ Environment.MachineName + "/MyGroup");
object members = directory.Invoke("Members", null);
foreach(object member in (IEnumerable) members){
 Console.WriteLine(entry.Name);
}

However if I use the same code and try to write out the
NativeGuid property then for the first object alls well
and then on the second pass of the foreach loop I get the
following exception.

System.Runtime.InteropServices.COMException: Logon
failure: unknown user name or bad password.

Anyone know why?

Cheers Rob
Rob Williams - 08 Dec 2004 08:40 GMT
Ooops! The code below was supposed to read...

Console.WriteLine(member.Name);

Thanks in advance for any help anyone can provide on this.

I've read some posts with similar problems where a
suggestion has been made of explicitly rebinding to the
directory each pass but I don't understand why this
should make any difference and also don't want to have to
rebind for every member of the group.

Rob

>-----Original Message-----
>Hi
[quoted text clipped - 22 lines]
>Cheers Rob
>.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.