im working on a app that will got through a pre defined list and people and set the "Change password at next logon" to 1 but not sure how to do this. I have gotten to the point where im finding the user by GetDirectoryEntry.Username but unsure how to find and set this attribute. Any help would be appreciated. here is the code so far
Imports System
Imports System.DirectoryServices
Namespace ActiveDirectorySearch
Public Class ADSearch
Shared Sub main(ByVal strUserName As String)
Dim DSESearcher As New DirectoryServices.DirectorySearcher
Dim RootDSE As String = DSESearcher.SearchRoot.Path
RootDSE = RootDSE.Insert(7, "ou=MINN Corporate,ou=Corp Users,")
Dim MySearcher As DirectorySearcher = New DirectorySearcher(RootDSE)
Dim objResults As SearchResult
MySearcher.Filter = "(ObjectType=User)"
For Each objResults In MySearcher.FindAll()
If objResults.GetDirectoryEntry.Username.ToString = strUserName Then
End If
Next
End Sub
End Class
End Namespace