martincarnegie
Technical User
Hi all,
I have a piece of code that is being used to add an account to Windows 2003. The code works fine, but if a password is used that does not meet the password requirements, it reports success when it actually failed. I have tried to build some error checking into the code which is working but is doing something weird.
Here is the code
1 Set colAccounts = GetObject("WinNT://" & strComputer & "")
2 Set objNewUser = colAccounts.Create("user", strUserName)
3 WScript.Echo objNewUser
4 objNewUser.FullName = strFullName
5 objNewUser.Description = strDescription
6 objNewUser.SetPassword strPassword
7 objNewUser.SetInfo
8
9 if Err.Number = &H8007007B Then
10 WScript.Echo "Account not created"
11 WScript.Quit Err.Number
12 End If
So when this runs it will work fine. I added line 3 to just see what it was doing. If I comment out or remove that line the code does not work anymore. It always reports as exiting with &H8007007B. Any ideas?
Thanks
Martin
Martin Carnegie
GulfBreeze Software - GulfBreeze Blog -
I have a piece of code that is being used to add an account to Windows 2003. The code works fine, but if a password is used that does not meet the password requirements, it reports success when it actually failed. I have tried to build some error checking into the code which is working but is doing something weird.
Here is the code
1 Set colAccounts = GetObject("WinNT://" & strComputer & "")
2 Set objNewUser = colAccounts.Create("user", strUserName)
3 WScript.Echo objNewUser
4 objNewUser.FullName = strFullName
5 objNewUser.Description = strDescription
6 objNewUser.SetPassword strPassword
7 objNewUser.SetInfo
8
9 if Err.Number = &H8007007B Then
10 WScript.Echo "Account not created"
11 WScript.Quit Err.Number
12 End If
So when this runs it will work fine. I added line 3 to just see what it was doing. If I comment out or remove that line the code does not work anymore. It always reports as exiting with &H8007007B. Any ideas?
Thanks
Martin
Martin Carnegie
GulfBreeze Software - GulfBreeze Blog -