Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently creating a VB project for the IT department to use, so that if someone enters a PC or Laptop asset number, this will query Active Directory and report back with the current logged on user / OS installed / and Active Directory OU that the object sits in.

What I have tried:

At present I have only drawn up the GUI side of things and written some of the basic code featuing a check box which needs to be ticked to enable a couple of buttons to work featuring a force restart / shut down of the asset. It's been many many (at least 10) years since I played with VB so it's feeling in areas new again for me.
Posted
Updated 11-Apr-16 2:27am

1 solution

Assuming you mean VB.NET, you can use the System.DirectoryServices[^] assembly / namespace to query and update Active Directory.

There are lots of examples on this site; for example: Querying Active Directory using .NET classes and LDAP queries[^]


If you meant VB6 or earlier, you'd need to use ADSI: Accessing Active Directory Using Visual Basic (Windows)[^]

NB: You'll struggle to find support for VB6, since it's been dead for over 10 years.
 
Share this answer
 
Comments
James Hollingsworth 7-Apr-16 17:03pm    
Thanks, i'll give this a try tomorrow and yes vb.net, apologies for not stating that on the original posted question... I originally learnt with vb6 as now that im coming back in to trying vb and it's called vb.net made me think everything has changed, which i'm sure it has in many ways which i'll find out if i can keep entertained within this area.
James Hollingsworth 8-Apr-16 10:58am    
Have I started the project badly... so i'm using Visual Studio 2015 Community, and I started the project as New --> Project --> Visual Basic --> Windows Forms Application.... Do I need it to be a different kind of application for this to work with Active Directory as I just don't seem to have the data connection available for system directory services.
Richard Deeming 8-Apr-16 11:01am    
Add a reference to the assembly:
Open "Solution Explorer";
Double-click the project to open the project designer;
Click the "References" tab;
Click the "Add" button;
Select "System.DirectoryServices" from the list, and add the reference;

Import the namespace:
At the top of your code file, add:
Imports System.DirectoryServices


You should then be able to use the Directory Services classes.
James Hollingsworth 11-Apr-16 8:27am    
Thanks for the help, I think i've managed to lose some of the files as now the application won't open up in Visual Studio... i'll start from scratch tonight and include the detail that you provided. Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900