Auto add of enabled functional users so you can build up a test pool of users or other objects….
Â
[Wed 06/21/2006 22:46:46.36]
F:\Dev\CPP\AdMod>admod -e -add -autobase 25:cn=autouser,ou=autousers,dc=joe,dc=com -bmod {{*RDN*}}_{{*cnt*}},{{*parent*}} objectclass::user -kerbenc unicodepwd::{{*rnd*:6:8}} samac
countname::{{*name*}}_{{*cnt*}} useraccountcontrol::512 -exterr
AdMod V01.07.00cpp_ALPHA Joe Richards (joe@joeware.net) June 2006
DN Count: 25
Using server: 2k3dc02.joe.com
Adding specified objects…
  DN: cn=autouser_0,ou=autousers,dc=joe,dc=com… “UZ0Hn*#T”
  DN: cn=autouser_1,ou=autousers,dc=joe,dc=com… “R;MG]#0l”
  DN: cn=autouser_2,ou=autousers,dc=joe,dc=com… “S8Lks~J”
  DN: cn=autouser_3,ou=autousers,dc=joe,dc=com… “{5tVDJ$”
  DN: cn=autouser_4,ou=autousers,dc=joe,dc=com… “DyJzQ|4g”
  DN: cn=autouser_5,ou=autousers,dc=joe,dc=com… “w5qm;l.”
  DN: cn=autouser_6,ou=autousers,dc=joe,dc=com… “H_xyLz2B”
  DN: cn=autouser_7,ou=autousers,dc=joe,dc=com… “EB7Fn2NS”
  DN: cn=autouser_8,ou=autousers,dc=joe,dc=com… “NMX2ZDXT”
  DN: cn=autouser_9,ou=autousers,dc=joe,dc=com… “+;X?.RLG”
  DN: cn=autouser_10,ou=autousers,dc=joe,dc=com… “vPeNWEJ”
  DN: cn=autouser_11,ou=autousers,dc=joe,dc=com… “Mrk:M?rx”
  DN: cn=autouser_12,ou=autousers,dc=joe,dc=com… “YiijpV=:”
  DN: cn=autouser_13,ou=autousers,dc=joe,dc=com… “tds~0]c”
  DN: cn=autouser_14,ou=autousers,dc=joe,dc=com… “hyKAjn.”
  DN: cn=autouser_15,ou=autousers,dc=joe,dc=com… “p#{U;T*”
  DN: cn=autouser_16,ou=autousers,dc=joe,dc=com… “%pZhkeUL”
  DN: cn=autouser_17,ou=autousers,dc=joe,dc=com… “WmwJ8$N”
  DN: cn=autouser_18,ou=autousers,dc=joe,dc=com… “$F!DnW-x”
  DN: cn=autouser_19,ou=autousers,dc=joe,dc=com… “uh]9t2CF”
  DN: cn=autouser_20,ou=autousers,dc=joe,dc=com… “Y#Xj33c”
  DN: cn=autouser_21,ou=autousers,dc=joe,dc=com… “V5;Z07Kz”
  DN: cn=autouser_22,ou=autousers,dc=joe,dc=com… “hdQl|9$j”
  DN: cn=autouser_23,ou=autousers,dc=joe,dc=com… “or!;IpE”
  DN: cn=autouser_24,ou=autousers,dc=joe,dc=com… “eBux1o@”
The command completed successfully
The lines show the DN of the user being created and the value in quotes is a random password. To walk through the switches (subject to change)
Â
-e Â
I added the -e option from adfind to use switch values from environment variables. In this case the only thing defined was adfind-h=2k3dc02 which is the DC I wanted to make the changes on so the -e inserted the command -h 2k3dc02.
Â
-addÂ
Add an object, this is old, you know how to do this already.
Â
-autobase 25:cn=autouser,ou=autousers,dc=joe,dc=comÂ
This is brand new. It inserts 25 copies of the DN specified into the DN list. For an add you sort of need some sort of base to start working with. The individual DNs are modified by the next switch. You will note that normally you have to specify a safety value when you go over 10, this switch handles that for you.
Â
 -bmod {{*RDN*}}_{{*cnt*}},{{*parent*}}
This indicates how to build the final DN. The current DN on the list is parsed out into several components, the specific ones used above are the RDN and Parent. There is an additional variable called CNT which is an autoincremement value.  The variables are specified with the {{*varname*}}.
Â
objectclass::user
This is old, specifying the class of the object to create… a user.Â
Â
-kerbenc
This is also old, tells the system to set up an encrypted connection so I can set the password.
Â
unicodepwd::{{*rnd*:6:8}}
Set the password to a random value between 6 and 8 characters long. If the min/max aren’t defined, the values are 15-25 characters. You can specify the character set if you would like (standard console ANSI only sorry folks), if not specified, the default is currently 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%*_-=+:;{}[],.?|~
Â
samaccountname::{{*name*}}_{{*cnt*}}
Set the samaccountname to the same value used for the new RDN. Since the official RDN has CN= in it I introduced a new variable called name that you use here instead of RDN.
Â
useraccountcontrol::512
Create account enabled, nothing new here.
Â
-exterr
Display extended errors, again nothing new here.Â
Â
This is cool! 😉
Instead of a sneak peak, can I download to try it? Playing around with Longhorn a lot and I would love to try it there. Can you mail me a copy?
Cool .. especially for test environments 🙂
Very cool…. another great feature would be adding options to create an Exchange mailbox at the same time. Instead of adding the users and then taking the ouput and creating exchange mailboxs, just save some typing and do it all in one step? I know this is much harder than it sounds though and would probably add complexity.
I know that we can use this and your other great ools and script it as well…. guess we can’t ask you to do everything for us… 🙂
Right now I install the Exchange stress tool which will create the users and accounts when I need to create thousands of unique users. It would be nice not to have to do that.
Cheers
Jorge:
Nope, no downloads yet, it is pure alpha code and I am changing things left and right and haven’t done any regression testing to see what I have broken yet.
Steve:
Well you could do it, simply set the attributes needed for the exchange mailbox in the command line. At a minimum that would be mailnickname and homemdb. This however is not the supported way to update Exchange, they want you to use CDOEXM and I refuse to put any more COM hooks into ADFIND, actually I am thinking about ripping out the setpassword stuff that is there now. Setting those attribs is discussed in three books now, all based on a chapter I wrote for Windows Server Cookbook, that got copied in part to Active Directory Third Edition, and copied in whole to Active Directory Cookbook Second Edition