Welcome to weblogs.com.pk Sign in | Join | Help

Using ADSI to create an Account

ADSI is an API that can be used to manage directory services; Windows is shipped with an ADSI provder called NTDS that can be used to manage accounts and groups using ADSI. Here is the Windows Scripting Host (WSH) script to get this done. Save it as VBS file and double click it from Explorer.

Set oDomain = GetObject("WinNT://ServerName")
Set oGroup = oDomain.GetObject("Group", "Group Name")

Set oUser = oDomain.Create("user", "UserName")
oUser.FullName = "User Full Name"
oUser.Description = "Some Description"
'oUser.ChangePassword "oldpassword", "newpassword"
'oUser.AccountDisabled = false
oUser.SetInfo

oUser.SetPassword "SomePassword"
oUser.SetInfo

oGroup.Add ("WinNT://ServerName/UserName")

Set oUser = Nothing
Set oGroup=Nothing
Set oDomain=Nothing

Published Friday, January 27, 2006 3:55 PM by khurram

Comments

No Comments

New Comments to this post are disabled