March 3, 2021
Hot Topics:

ADSI for Beginners

  • By Sam Huggill
  • Send Email »
  • More Articles »

There are two ways in which we can encapsulate our ADSI code. Firstly, we can use simple VB Scripts (a .vbs extension). This is the best approach if you are going to be performing server management at the server itself, or on the same subnet. In that way you can execute scripts locally from the command line, making these administrative tasks quick and simple.

However, if you server will be located separately from you, or you want to perform administration over your intranet or even the Internet, then you might want to consider wrapping up the code in a DLL, being made accessible by a set of ASP pages.

For our example we will be placing the code in a DLL, written in VB, and called from ASP. For more information on using ASP to access DLLs, take a look at: http://www.vbsquare.com/internet/aspdev/

Ok. Well I wont go into great details in writing the DLL, but here are several steps you need to take to ensure you can access your DLL:

-Create a class module named clsAdmin
-Set the Instancing property to 5 — Multiuse
-Place your code in the class module, defining the routines as Public
-Compile your DLL as per normal

Now that you have your DLL setup, all you need to do is write several nice looking ASP pages to provide an interface, and place some VB Script code behind it to interface with the DLL. Here's a quick snippet of code to access your DLL from ASP:

<%Set objAdmin = Server.CreateObject("Project1.clsAdmin")ObjAdmin.ResetPassword "username","password"Set objAdmin = Nothing%>

To download a demonstration DLL and set of ASP pages click on the link below:


Now that we have the basics in place, lets go on to learn how to build a small scale, web based management system using ADSI!

Page 4 of 5

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date