Home All Groups Group Topic Archive Search About
Author
8 Mar 2006 4:59 PM
Janus
Hi,

I have an AD with a security policy (password length, password complexity
enable).

Why can I create a user account in AD (with a vbs script) with a blanck
password?

Thanks.
Janus.

Author
8 Mar 2006 7:40 PM
Paul Williams [MVP]
It is possible to set a user object so that they don't require a password,
regardless of domain complexity requirements.  I can't remember the
attribute, or bit, but it is easy to do with NET:
-- http://www.msresource.net/content/view/21/48/


How are you creating the user in VBS?  Can you post the code?

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
10 Mar 2006 11:46 AM
Janus
Hi,

the script is:

Set objOU = GetObject("LDAP://ou=Users,dc=domain,dc=fr")
Set objUser = objOU.Create("User", "cn=AA112")
objUser.Put "sAMAccountName", "AA112"
objUser.Put "givenName", "Anicet"
objUser.Put "sn", "Aseplier"
objUser.Put "userAccountControl", "544"
objUser.SetInfo

'End of script.

Can i create a user account (with a vbs script ) wich respects the security
policy?

Thanks.
Janus

Show quoteHide quote
"Paul Williams [MVP]" wrote:

> It is possible to set a user object so that they don't require a password,
> regardless of domain complexity requirements.  I can't remember the
> attribute, or bit, but it is easy to do with NET:
>  -- http://www.msresource.net/content/view/21/48/
>
>
> How are you creating the user in VBS?  Can you post the code?
>
> --
> Paul Williams
> Microsoft MVP - Windows Server - Directory Services
> http://www.msresource.net | http://forums.msresource.net
>
>
>
Author
10 Mar 2006 2:38 PM
Paul Williams [MVP]
544 - 512 = 32

512 = normal user
32 = password not required


Don't set the userAccountControl attribute to include the PASSWD_NOTREQD
bit.

Use something like this:

Set objOU = GetObject("LDAP://ou=Users,dc=domain,dc=fr")
Set objUser = objOU.Create("User", "cn=AA112")
objUser.Put "sAMAccountName", "AA112"
objUser.Put "givenName", "Anicet"
objUser.Put "sn", "Aseplier"
objUser.SetInfo
objUser.setPasswordaC0mpl3xP@55w0rd~!
objUser.accountDisabled=false
objUser.setInfo


Basically, the first setInfo sets the account as disabled (514 = normal
(512) + disabled (2)).  You then set a password, and then set as enabled.

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
10 Mar 2006 3:50 PM
Paul Williams [MVP]
Sorry, OE converted the statement:

objUser.setPassword"<password>" into an e-mail as I used a semi-complex
password as an example.  Note you must encapsulate in quotes, or pass a
string variant.

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
15 Mar 2006 8:11 PM
Janus
Hi,

Thanks for this answer. If I understand, the solution is create a user
account with a password and it's logic.
But I don't understand why I can create and activate an account wich don't
respect the policy implemented on AD.



Show quoteHide quote
"Paul Williams [MVP]" wrote:

> Sorry, OE converted the statement:
>
> objUser.setPassword"<password>" into an e-mail as I used a semi-complex
> password as an example.  Note you must encapsulate in quotes, or pass a
> string variant.
>
> --
> Paul Williams
> Microsoft MVP - Windows Server - Directory Services
> http://www.msresource.net | http://forums.msresource.net
>
>
>
Author
16 Mar 2006 8:51 AM
Paul Williams [MVP]
You can set an account to not have a password.  This overrides the password
complexity requirements of the domain.  You set this bit via
userAccountControl (the 7th bit) or via NET USER:
-- http://www.msresource.net/content/view/21/48/


You are setting this bit (flag).

You shouldn't really be setting the 7th bit of userAccountControl.  Instead
you should create a normal user with a password.

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
18 Mar 2006 11:00 PM
Joe Richards [MVP]
Actually if you have a password length policy in place, the system will
automatically set the pwd not reqd when using vbscript because you can't use
adsi to set the password prior to the first setinfo. After the setinfo and after
you have set a password you will need to correct the uac value by setting it to
512 (or 514 if you still want it disabled).

--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

         http://www.joeware.net/win/ad3e.htm



Paul Williams [MVP] wrote:
Show quoteHide quote
> 544 - 512 = 32
>
> 512 = normal user
> 32 = password not required
>
>
> Don't set the userAccountControl attribute to include the PASSWD_NOTREQD
> bit.
>
> Use something like this:
>
> Set objOU = GetObject("LDAP://ou=Users,dc=domain,dc=fr")
> Set objUser = objOU.Create("User", "cn=AA112")
> objUser.Put "sAMAccountName", "AA112"
> objUser.Put "givenName", "Anicet"
> objUser.Put "sn", "Aseplier"
> objUser.SetInfo
> objUser.setPasswordaC0mpl3xP@55w0rd~!
> objUser.accountDisabled=false
> objUser.setInfo
>
>
> Basically, the first setInfo sets the account as disabled (514 = normal
> (512) + disabled (2)).  You then set a password, and then set as enabled.
>
Author
19 Mar 2006 11:42 AM
Paul Williams [MVP]
How come we can't set the password with the other attributes and have to
perform two setInfo's?  Do you know what the limitation actually is?

I imagine that this isn't the case in other languages?

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
19 Mar 2006 6:36 PM
Joe Kaplan (MVP - ADSI)
It is really a limitation of how ADSI works.  SetPassword will only work on
an object that already exists in the directory.  ADSI also doesn't provide a
mechanism where you can set unicodePwd correctly during object creation.  As
such, you often end up with a three step process:
- Create account
- Set password
- Enable account

If you use a lower level API (LDAP C, .NET S.DS.Protocols, LDIF), you can do
the whole thing at once, even if there is a password policy in place.  For
most of us, the extra effort isn't worth the perf increase.  If I needed to
fill a DC or ADAM instance with thousands of accounts with passwords and
enabled status at high speed, I might write the .NET code or perhaps the
LDIF file to do it.  There is very little chance you'd get me to write the C
code these days.  :)  Joe Richards on the other hand...

Joe K.

Show quoteHide quote
"Paul Williams [MVP]" <ptw2***@hotmail.com> wrote in message
news:uBnaEp0SGHA.4340@tk2msftngp13.phx.gbl...
> How come we can't set the password with the other attributes and have to
> perform two setInfo's?  Do you know what the limitation actually is?
>
> I imagine that this isn't the case in other languages?
>
> --
> Paul Williams
> Microsoft MVP - Windows Server - Directory Services
> http://www.msresource.net | http://forums.msresource.net
>
>
Author
19 Mar 2006 7:33 PM
Joe Richards [MVP]
....would use admod or use one of his many LDAP routines already written and wrap
it into some custom code in c++. :o)

--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

         http://www.joeware.net/win/ad3e.htm



Joe Kaplan (MVP - ADSI) wrote:
Show quoteHide quote
> It is really a limitation of how ADSI works.  SetPassword will only work on
> an object that already exists in the directory.  ADSI also doesn't provide a
> mechanism where you can set unicodePwd correctly during object creation.  As
> such, you often end up with a three step process:
>  - Create account
>  - Set password
>  - Enable account
>
> If you use a lower level API (LDAP C, .NET S.DS.Protocols, LDIF), you can do
> the whole thing at once, even if there is a password policy in place.  For
> most of us, the extra effort isn't worth the perf increase.  If I needed to
> fill a DC or ADAM instance with thousands of accounts with passwords and
> enabled status at high speed, I might write the .NET code or perhaps the
> LDIF file to do it.  There is very little chance you'd get me to write the C
> code these days.  :)  Joe Richards on the other hand...
>
> Joe K.
>
> "Paul Williams [MVP]" <ptw2***@hotmail.com> wrote in message
> news:uBnaEp0SGHA.4340@tk2msftngp13.phx.gbl...
>> How come we can't set the password with the other attributes and have to
>> perform two setInfo's?  Do you know what the limitation actually is?
>>
>> I imagine that this isn't the case in other languages?
>>
>> --
>> Paul Williams
>> Microsoft MVP - Windows Server - Directory Services
>> http://www.msresource.net | http://forums.msresource.net
>>
>>
>
>
Author
20 Mar 2006 8:41 AM
Paul Williams [MVP]
Ah well...

Looks like I'm going to have to learn either .NET or C.  I've briefly played
with .NET.  It's been a while since I played with C (and I mean played -
lame little apps like hello world, etc).

I think I'll have to buy Joe (Ks) book and take it from there.  If I can do
that, maybe C can follow later.  I know I'm bored with VBScript now, and
don't fancy Perl...

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
20 Mar 2006 2:57 PM
Joe Kaplan (MVP - ADSI)
If you come to DEC, check out my talk (last day, last session).  It is all
about this kind of stuff.

We are also going to talk about Monad in the context of writing DS code that
uses .NET in a scripting context.  You might be interested.

Joe K.

Show quoteHide quote
"Paul Williams [MVP]" <ptw2***@hotmail.com> wrote in message
news:Olk3Co$SGHA.792@TK2MSFTNGP10.phx.gbl...
> Ah well...
>
> Looks like I'm going to have to learn either .NET or C.  I've briefly
> played
> with .NET.  It's been a while since I played with C (and I mean played -
> lame little apps like hello world, etc).
>
> I think I'll have to buy Joe (Ks) book and take it from there.  If I can
> do
> that, maybe C can follow later.  I know I'm bored with VBScript now, and
> don't fancy Perl...
>
> --
> Paul Williams
> Microsoft MVP - Windows Server - Directory Services
> http://www.msresource.net | http://forums.msresource.net
>
>
Author
21 Mar 2006 8:16 PM
Paul Williams [MVP]
I'm very interested and planned on a) coming to that session and b) buying
your book.  Oh, and probably c) having a drink with you...

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
23 Mar 2006 6:47 AM
Joe Richards [MVP]
Damn that was the time slot Dean and I wanted so we could have fun recapping the
entire conference in a fun way. Instead we got slapped into early Monday
afternoon or so.


--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

         http://www.joeware.net/win/ad3e.htm



Joe Kaplan (MVP - ADSI) wrote:
Show quoteHide quote
> If you come to DEC, check out my talk (last day, last session).  It is all
> about this kind of stuff.
>
> We are also going to talk about Monad in the context of writing DS code that
> uses .NET in a scripting context.  You might be interested.
>
> Joe K.
>
> "Paul Williams [MVP]" <ptw2***@hotmail.com> wrote in message
> news:Olk3Co$SGHA.792@TK2MSFTNGP10.phx.gbl...
>> Ah well...
>>
>> Looks like I'm going to have to learn either .NET or C.  I've briefly
>> played
>> with .NET.  It's been a while since I played with C (and I mean played -
>> lame little apps like hello world, etc).
>>
>> I think I'll have to buy Joe (Ks) book and take it from there.  If I can
>> do
>> that, maybe C can follow later.  I know I'm bored with VBScript now, and
>> don't fancy Perl...
>>
>> --
>> Paul Williams
>> Microsoft MVP - Windows Server - Directory Services
>> http://www.msresource.net | http://forums.msresource.net
>>
>>
>
>
Author
23 Mar 2006 7:55 AM
Paul Williams [MVP]
I'm sure you'll still be able to take the piss out of plenty of people ;-)

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net
Author
23 Mar 2006 3:46 PM
Joe Kaplan (MVP - ADSI)
Sorry man.  I think Gil was trying to make sure we had the bad timeslot.  :)

Joe K.

Show quoteHide quote
"Joe Richards [MVP]" <humorexpr***@hotmail.com> wrote in message
news:eYDeaWkTGHA.1672@tk2msftngp13.phx.gbl...
> Damn that was the time slot Dean and I wanted so we could have fun
> recapping the entire conference in a fun way. Instead we got slapped into
> early Monday afternoon or so.
>
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
>         http://www.joeware.net/win/ad3e.htm
>
>
>