Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Visual Studio .NET
IDE
VS.Net Server Explorer Add-In Install Problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Mykre, post: 676, member: 250"] Here is a small snippit that reads all of the computers from the AD, It was taken from the common tasks on the quickstart guides on GotdotNET.com [CODE] [size=2][color=#0000ff] Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Module[/color][/size][size=2] ReadAD [/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] main() [/size][size=2][color=#008000]'This will only work if you are connected to an active directory. [/color][/size][size=2][/size][size=2][color=#008000]'Add a reference to system.directoryservices. Replace NetworkName with your [/color][/size][size=2][/size][size=2][color=#008000]'network name. [/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] de [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.DirectoryServices.DirectoryEntry("LDAP://NetworkName") [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ds [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.DirectoryServices.DirectorySearcher(de) [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] r [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.DirectoryServices.SearchResult ds.Filter = "(objectClass=computer)" [/size][size=2][color=#0000ff]Try [/color][/size][size=2][/size][size=2][color=#0000ff]For[/color][/size][size=2] [/size][size=2][color=#0000ff]Each[/color][/size][size=2] r [/size][size=2][color=#0000ff]In[/color][/size][size=2] ds.FindAll [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] s [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String [/color][/size][size=2]Console.WriteLine(r.GetDirectoryEntry.Name.ToString) [/size][size=2][color=#0000ff]Next [/color][/size][size=2][/size][size=2][color=#0000ff]Catch[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception Console.WriteLine(e.ToString) [/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Try [/color][/size][size=2]Console.ReadLine() [/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub End[/color][/size][size=2] [/size][size=2][color=#0000ff]Module [/color][/size] [/CODE] The libraries you need to look into are in the system.directoryservices namepace. Mykre [/QUOTE]
Insert quotes…
Verification
Post reply
Visual Studio .NET
IDE
VS.Net Server Explorer Add-In Install Problem
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom