facebook  linkedin  Twitter  skype  Rss googlePlus

Entries for 'adsi'

ADSI: Display Domains

Oct 12 2004
4252
The following code will display all domains in a forest: 'function to list all available domains Sub DisplayDomainSelect  Dim adsNS  Dim adsDomain  Set adsNS = GetObject("WinNT:")  adsNS.Filter = Array("domain")  For Each adsDomain In adsNS   Response.Write adsDomain.ADsPath & " "  Next  Set adsNS = Nothing End Sub

ADSI: Get Group Membership for Account

Oct 12 2004
5046
The following code will use ADSI to obtain all the groups assigned for a specific user account: Dim strDomain = “mydomain“ Dim strUser = “someuser“   Function GetMemberGroups()  Dim oUser = GetObject(strDomain & "/" & strUser)  Dim strTemp  For Each oGroup In oUser.Groups   strTemp = strTemp & oGroup.Name & " "  Next  GetMemberGroups = strTemp End Function

ADSI: Change an Account Password

Sep 24 2004
5020
The following ADSI code will change a password for specified account: ' accepts the old password and new password for changing. Sub ChangePassword(strOldPassword, strNewPassword)     On Error Resume Next     Set oUser = GetObject(strDomain & "/" & strUSer)     oUser.Password = strNewPassword     oUser.SetInfo     Set oUser = Nothing     If Err <> 1 Then         ...

ADSI: Unlock an User Account

Sep 24 2004
5154
The following code can be used for unlocking a domain account. CONST UF_LOCKOUT = &H0010   Sub UnlockAccount     Set oUser = GetObject(strDomain & "/" & strUser)     Flags = oUser.Get("UserFlags")     oUser.Put "UserFlags", Flags Xor UF_LOCKOUT     oUser.SetInfo     Set oUser = Nothing End Sub

ADSI: Change an Account Description

Sep 24 2004
4805
The following code will change the description of an account using ADSI: 'accepts a string for the description.   Sub ChangeAccountDescription(strDescription)     On Error Resume Next     Set oUser = GetObject(strDomain & "/" & strUser)     oUser.Description = strDescription     oUser.SetInfo     Set oUser = Nothing     If Err <> 0 Then         strServerE...
Displaying 1 of 3 - Next Page