ExchMbx V01.04.00cpp Joe Richards (joe@joeware.net) April 2006
Usage:
ExchMbx [switches]
Switches: (designated by - or /)
-h host Host to use, use default LDAP server
-b basedn DN to do the work on. If basedn is not specified
the program will read from stdin anything piped to it
or if you want you can type the DNs there followed by
a ctrl-z to terminate the pipe.
-elapsed Display elapsed time in seconds
-cr MDB Create Mailbox in MDB - See Format Below for that value
-move MDB Move Mailbox to MDB - See Format Below for that value
-xag Use this with move for Cross-AG moves, requires E2K3 SP2
-me x MailEnable object. If necessary x is targetaddress.
-clear Clear all email attribs.
-upd Update, use on existing objects for quota and AL mods
-safety x How many objects before safety kicks in. Default 10
-delim x X specifies delimiter for MDB format. Default :
-fdelim x X specified delimiter for file format. Default [TAB]
-unsafe Don't have a safety, modify objects no matter how many.
-upto x Process DNs until x successes have occurred.
-cont Continue with objects even if errors.
-hfal Hide from address lists.
-uhfal Unhide from address lists.
-keepmail When used with -me uses existing mail attribute for targetAddress.
-quota x:y:z Set Quota, x=Warn MB, y=Stop Send MB, z=Stop Receive MB.
Use :: to set quota to system default.
-internetencoding This is the encoding type for mailenabled objects.
MDB format
Format: (HomeMDBURL|Server:Storage Group:DataBase)
This value can be specified either as a complete HomeMDB URL value
or if you don't know it or don't want to look it up you can specify
the server, storage group, and data base and the tool will look up
the proper HomeMDB URL for you.
Internet Encoding Format
Mail enabled objects can either follow the Internet Mail Service
settings for how mail is encoded for transfer out of the Exchange
system or you can specify specific values. This switch lets you
change that setting. The default value written to the mail enabled
objects is 1310720 which is 'Use Internet Mail Service' settings.
See KB281740 for more info on the settings, here are some alternate
values at the time of this writing:
393216 MIME with Plain Text
917504 MIME with HTML
1441792 MIME with Plain Text & HTML
2228224 Plain Text / uuencode
131072 Plain Text / uuencode with Binhex
Notes:
This tool could be considered dangerous, it can quickly make some
serious changes to your directory and really mess up email.
I take no responsibility for you dorking up your email system.
The safety option will bail the whole operation if there
are more objects to work on than specified with the -safety option.
This tool is exceptionally powerful when used in conjunction with
a command line LDAP query tool such as my own adfind with the -dsq
switch or dsquery from Microsoft.
If you get an error updating an object, no modification is made
to the specific object.
When doing multi-DN modifications, the errorlevel will be set to the
last error encountered. So if you go through 8 DNs and hit 3 errors,
only the last will be passed back to you via %errorlevel%.
Be very very careful of clear option. You can literally clear all mail
objects in your forest with that command in a relatively simple way.
This program has the ability to read the DN to modify from STDIN for
instance you could take the output from program 1 and send it into this
program like:
someprogram | exchmbx -move server1:sg1:db1 -upto 100
which would take the output from someprogram and then use that for the
the DN list for exchmbx. So for instance say I wanted to move all
mailboxes of users in a specific OU to another Exchange Server or another
database I could do so by combining an LDAP search from ADFIND or
dsquery with exchmbx...
You can also have a list of DNs in a text file and pipe in from there
like this:
exchmbx -move srv1:sg1:db3 < file.txt
In addition you can add override info to the piped in information
as well... Say you want to move all users except a couple of them
to one place you have the command above but then on the lines holding
DNs you wanted moved to another location you add that information.
Basically it is all in the format of the input. If you are just sending
in DNs the format should be:
"cn=something,ou=something,dc=domain,dc=com"
and should have the quotes around the DN. If you want to add override
information simply follow the DN with TAB character and a quoted string
with the override info like so:
"cn=something,ou=something,dc=domain,dc=com"
"cn=something2,ou=something,dc=domain,dc=com"
"cn=something3,ou=something,dc=domain,dc=com" "srv2:sg1:db3"
which when combined with the command:
exchmbx -move srv1:sg1:db1 < file.txt
would result in something3 going to srv2:sg1:db3 and the other objects
going to srv1:sg1:db1
This override functionality works for -cr, -move, -me options.
Ex1:
ExchMbx -b cn=joe,dc=joe,dc=net -cr srv1:sg1:db2
Create mailbox for joe in Server srv1, storage group sg1, database db2.
Ex2:
ExchMbx -b cn=joe,dc=joe,dc=net -move srv1:sg1:db2
Ditto ex1 but move.
Ex3:
ExchMbx -b cn=joe,dc=joe,dc=net -move CN=DB1,CN=SG1,CN=InformationStore,CN=2K3EXC01...
Ditto ex1 but move to specified URL (URL chopped short).
Ex4:
ExchMbx -b cn=joe,cn=users,dc=joe,dc=net -clear
Clear Exchange attrs for joe, will delete mailbox or
clean email addresses of mailenabled objects.
Ex5:
ExchMbx -b cn=gr1,cn=users,dc=joe,dc=net -me
Mail Enable group gr1
Ex6:
ExchMbx -b cn=con1,cn=users,dc=joe,dc=net -me joe@joeware.net
Mail Enable contact con1 with email address joe@joeware.net
Ex8:
adfind -b ou=new,dc=joe,dc=net -f "&(objectcategory=person)(objectclass=user)" -dsq |exchmbx -upto 100 -cre s1:sg1:db1
Mailbox enable the first 100 users of the OU called new.
This software is Freeware. Use it as you wish at your own risk.
If you have improvement ideas, bugs, or just wish to say Hi, I
receive email 24x7 and read it in a semi-regular timeframe.
You can usually find me at joe@joeware.net