I need to be able to enable an Active Directory user account when I click submit. I have page setup with the following:
1. User select OU member from dropDownList1.
3. ObjUser is plugged into the Active Direct Search routine as so:
searchMe.Filter = "(&(objectclass=user)(sama
=" & objUser & "))"
4. This is used to populate other tables on the page such as the account description etc.
Below is the code for adsearcher. Is there another attribute I need to be pulling during this sub and what would I need to set it to in order to enable the user account?
Thanks in advance!!
Public Sub adSearcher()
Dim adInfo As New DirectoryServices.DirectoryEntry(strLpath)
Dim searchMe As New System.DirectoryServices.DirectorySearcher(adInfo)
searchMe.Sort.Direction = SortDirection.Ascending
searchMe.PageSize = 10
searchMe.Filter = "(&(objectclass=user)(samaccountname=" & objUser & "))"
searchMe.SearchScope = SearchScope.Subtree
Dim results As SearchResultCollection
results = searchMe.FindAll()
Dim result As SearchResult
arrCount = intcount - 1
Dim myDarr1(arrCount, 7) As String
arrCount = 0
For Each result In results
intcount = intcount + 1
If InStr(result.Properties("DisplayName")(0), "$") Then
resDescription = result.Properties("description")(0)
Catch ex As Exception
resDescription = ""
TextBox1.Text = resdescription