Sorry here is the code _ Public Function Create_users_on_server(ByVal login As String, ByVal User_password As String, ByVal password As Integer) Dim x As VariantType Dim dirEntry As DirectoryEntry dirEntry = New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim entries As DirectoryEntries = dirEntry.Children If password = (PassWordFactor * System.DateTime.Now.Day) Then ' Set login name and full name. Dim newUser As DirectoryEntry = entries.Add(login, "User") newUser.Properties("Description").Add(login) ' User must change password at next logon (1 - true, 0 - false) newUser.Properties("PasswordExpired").Add(0) ' Password never expires. 'newUser.Properties("PasswordAge").Add(0) ' Set flags - User Cannot change password | Password never expires. newUser.Properties("Userflags").Add(&H40 Or &H10000) ' Set the password. Dim result As Object = newUser.Invoke("SetPassword", User_password) x = newUser.Path newUser.CommitChanges() ' Add user to the group "Members" Dim grp As DirectoryEntry = dirEntry.Children.Find("Members", "group") If (Not grp Is Nothing) Then grp.Invoke("Add", New Object() {newUser.Path.ToString()}) End If End If End Function
Progress is a process , so value it