469,318 Members | 1,914 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,318 developers. It's quick & easy.

How do you uncheck "User cannot change password" and "Password never exipers" attributes in vb.net

Does anyone have any code that can do this. From what I understand,
these are flags in the "userAccountControl" properties but unsure how
to get it unchecked. Can anyone help?

Imports System
Imports System.DirectoryServices

Namespace ActiveDirectorySearch
Public Class ADSearch
Shared Sub main(ByVal strUserName As String)
Dim Entry As New
Dim DSESearcher As New DirectorySearcher(Entry)
Dim strFilter As String = "(sAMAccountName=" & strUserName
& ")"
Dim objUser As DirectoryEntry

DSESearcher.SearchScope = SearchScope.Subtree
DSESearcher.Filter = strFilter
DSESearcher.PropertiesToLoad.Add("userAccountContr ol")

Dim objResult As SearchResult = DSESearcher.FindOne

If Not objResult Is Nothing Then

objUser = objResult.GetDirectoryEntry

objUser.Properties("pwdLastSet").Value = 0

End If

End Sub
End Class
End Namespace

Sep 27 '06 #1
0 1529

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by twhan twhan via .NET 247 | last post: by
2 posts views Thread by ChInKPoInt [No MCSD] | last post: by
reply views Thread by damontimm | last post: by
3 posts views Thread by =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.