March 1, 2021
Hot Topics:

ADSI for Beginners

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

Below are a few simple scripts written in VB Script, which allow an administrator to create users, add users to groups, change passwords and reset passwords. The code is pretty self explanatory, but if you have any queries please use the Post Feedback Now link at the bottom of the page.

'Add a new user using ADSI and the WinNT namespaceSet adsDomain = GetObject("WinNT://MyDomain")Set adsUser = adsDomain.Create("user","shuggill")adsUser.SetInfo'Now add the user to a groupSet adsGroup = GetObject("WinNT://MyDomain/MyGroup")adsGroup.Add "WinNT://MyDomain/shuggill"'Change the user's passwordSet adsUser = GetObject("WinNT://MyDomain/shuggill")adsUser.ChangePassword "oldpassword", "newpassword"adsUser.SetInfo'Reset the user's passwordSet adsUser = GetObject("WinNT://MyDomain/shuggill")AdsUser.SetPassword "newpassword" 

Now that we have looked at the way ADSI fits together with a variety of providers and some simple scripts, lets look at the best way to store the code.

Page 3 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