Use ADSI with WSH

Administrators can use ADSI with WSH. NT 5.0 will include WSH; for NT 4.0, you need to download it from management/WSH. htm. You can create scripts with any text processor (such as Notepad) and run the scripts in a command window with the command

cscript myscript.vbs

You can replace cscript with wscript so that you can use a graphical interface. However, wscript shows each line of output in a separate message box. If you list 200 users, you will get 200 message boxes.

The code in this article is written in VB, but it also works with WSH, with the exception of the code to determine the optional properties. To write the examples in WSH, follow these steps:

1. Remove all Dim statements.
2. Replace each Debug.Print with WScript.Echo.
3. Put a comma instead of the tab character (Chr$(9)).
4. Remove the variable names on the Next lines.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.