ADSI for Beginners
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