I set my local security policy min. password length to seven and ran the code
again and I receive this exact error (i tried to create the user "dus"):
Unable to create user dus with password The password does not meet the
password policy requirements. Check the minimum password length, password
complexity and password history requirements. (Exception from HRESULT:
0x800708C5)
When I set the min. password length to 0 the code works fine. Once more the
code to create the user:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CreateUser("dus")
End Sub
Private Sub CreateUser(ByVal User As String)
'Create Account
Try
Dim strUser As String = User
Dim oDomain As Object = GetObject("WinNT://" +
Environment.MachineName)
Dim oUser As Object = oDomain.Create("user", strUser)
If (Err.Number = 0) Then
oUser.SetInfo()
oUser.SetPassword("Nrg2005")
oUser.SetInfo()
'SaveLog("Created user " & User)
Else
'SaveLog("Unable to create user " & User)
Diagnostics.EventLog.WriteEntry("Rename Tool", "Unable to
create user " & User & " with password ", EventLogEntryType.Warning)
End If
Catch ex As Exception
'SaveLog("Unable to create user " & User & ". More info: " &
ex.Message)
Diagnostics.EventLog.WriteEntry("Rename Tool", "Unable to create
user " & User & " with password " & ex.Message, EventLogEntryType.Warning)
End Try
End Su
""Yuan Ren[MSFT]"" wrote:
Hi Philip,
Thanks for your reply!
I'm sorry for misunderstanding. But I wonder your meaning is the
SetPassword doesn't work in the current application. If this is true, could
you please supply more details? This means some error message or event log.
Thanks for your understanding.
I'm looking forward your reply!
Regards,
Yuan Ren [MSFT]
Microsoft Online Support