Cooking with Windows Server, Part 2
Pages: 1, 2, 3
Discussion
If you leave the IP address for your new site as All Unassigned, your
new site will be the default web site for your computer, which is the
web site the server returns when a browser tries to access an IP
address not currently assigned to another site. For example, if a
computer has three IP addresses--172.16.12.50, 172.16.12.51, and
172.16.12.52--and only the first address has been assigned to a site,
then opening the URLs http://172.16.12.51 or http://172.16.12.52 will return the default
web site. It's a good idea to have a default web
site configured with general contact information about your company
on a server that will be hosting many sites. Note that if there is
already a web site that has All Unassigned for its IP address (such
as the Default Web Site created when IIS is installed) then if you
assign All Unassigned to another site you won't be
able to start that site.
Host headers are a feature of the HTTP/1.1 specification and allow IIS to host multiple web sites that have the same IP address and port number but different DNS identities. You can't use host headers for sites that use SSL, however, and to use host headers you must have DNS name resolution working on your network. Also, don't assign any host header names to the Default Web Site. One good side of host headers is that when you have thousands of web sites hosted on a single IIS computer, using host headers to identify them incurs a smaller performance hit than using individual IP addresses.
Using VBScript
The one tricky thing about this code is setting up the
ServerBindings array. For whatever reason, instead
of making the web site IP address, port, and host header part of the
parameters to the CreateNewSite method, they must
be concatenated together in an array element and separated by a
colon.
See Also
Recipe 12.4, Recipe 12.17, MS KB 304187 (IIS: Home Directory Cannot Point to Mapped Drives), and MS KB 816568 (HOW TO: Manage Web Sites and Web Virtual Directories by Using Command-Line Scripts in IIS 6.0)
Mailbox-Enabling a User
Problem
You want to create a mailbox for a user. This is also known as mailbox-enabling a user.
Solution
Using a Graphical User Interface
-
Open the ADUC snap-in.
TIP: This needs to be run on a workstation or server that has the Exchange Management Tools loaded (see Recipe 17.6).
-
If you need to change domains, right-click on Active Directory Users and Computers in the left pane, select Connect to Domain, enter the domain name, and click OK.
-
In the left pane, browse to the parent container of the user, right-click on the user, and select Exchange Tasks.
-
On the Welcome screen, click Next.
-
Select Create Mailbox and click Next.
-
Verify the mail alias is what you want, select the server you want the mailbox on, select which store where you want the mailbox, and click Next.
-
On the Completion screen, click Finish.
Using a Command-Line Interface
> exchmbx -b "<UserDN>"-cr"<server>:<storage group>:<mail store>"
Or alternatively, run the following command:
> exchmbx -b <UserDN> -cr"<Home MDB URL>"
To mailbox-enable user joe with a mailbox on Exchange Server SRV1, Storage group SG1, and mailbox store DB1, execute the following command:
> exchmbx -b "cn=joe,cn=users,dc=rallencorp,dc=com"-cr "srv1:sg1:db1"
TIP: I highly recommend that you keep your storage group and mailbox store names short, simple, and "space" free. Spaces are troublesome to deal with at the command prompt and have caused many administrators unneeded grief. If you do not use spaces and other special characters, you can dispense with the quotes in all of the command-line examples.
Replace <UserDN> with the
user's distinguished name,
<server> with the Exchange server
name, <storagegroup> with the storage group,
<mailstore> with the mail store, and
<Home MDB URL> with the full
homeMDB URL for the desired mailbox store.
Using VBScript
' This code creates a mailbox for a user.
' ------ SCRIPT CONFIGURATION ------
strUserDN = "<UserDN>" ' e.g., cn=jsmith,cn=Users,dc=rallencorp,dc=com
strHomeMDB = "<Home MDB DN>"
' e.g. CN=Mailbox Store (SERVER),CN=First Storage Group,CN=InformationStore,
' CN=SERVER,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,
' CN=RALLENCORPMAIL,CN=Microsoft Exchange,CN=Services,
' CN=Configuration,DC=rallencorp,DC=com"
' ------ END CONFIGURATION ---------
set objUser = GetObject("LDAP://" & strUserDN)
objUser.CreateMailBox strHomeMDB
objUser.SetInfo( )
Wscript.Echo "Successfully mailbox-enabled user."

