Exchange Server 2010 to 2016 Lab #5

Now that we already have our simple Exchange Server 2010 environment, on this Part #5 let us create more mailboxes and send emails to populate our mailboxes.

Before we continue, let’s us review and configure a few more things. Open the Exchange Management Console. Expand Microsoft Exchange On-Premises, you will see: Organization Configuration, Server Configuration, Recipient Configuration, and Toolbox. There, expand Organization Configuration, select Hub Transport, and then click on the Accepted Domains tab.
EX5_00

The Accepted Domains are SMTP domains for which Microsoft Exchange accepts incoming messages. In there you should have your Active Directory Domain listed (contosovlab.com). You can add a different Domain if you want to receive messages from a different domain (You would also have to create a send connector and configure your DNS). The Send Connectors tab should be empty right now.

Now, on the right pane expand Server Configuration, select Hub Transport, there under the Receive Connectors tab of your Exchange computer. You will see two connectors created by default. In my case those connectors are Client EXLABEX1 and Default EXLABEX1.
EX5_01

Right-click the Default EXLABEX1, and click on Properties
EX5_02

Click on the Permission Groups tab and check the box for Anonymous users. This will allow your Exchange server to accept incoming mail delivery from remote mail servers.
EX5_03

Finally, expand Recipient Configuration, select Mailbox, you will see the list of mailboxes you have. Now you should have just two users, the admin user (VlabUser) and the Test user.
EX5_04

Creating more Mailboxes

To make the test more realistic we would need more than 2 users. Therefore the next step is to create a list of test-user’s mailboxes. This step will be quite easy as there are many blogs in the internet sharing scripts on how to populate Active Directory with test users, my personal favorite is this blog. So, in my case I use the Fake Name Generator to create a CSV file with the “Given Name”, “Surname” and “Email Address” in it. For your first try I would recommend to use a short list of 10 names for testing, if the test is successful then you can try with more names, the Fake name Generator, allows you to get up to 50,000 names. After requesting the names, you will receive a email with the link to your CSV file with all names.

After receiving the link to the CSV file to your email address download it. You will notice that the email addresses are all with different domains, so the next step is to fix (modify) the email addresses with PowerShell.

Open PowerShell. First we need to import the CSV file, I changed the name of the CSV file I downloaded to FakeName.csv just run the following cmdlet:

#Import CSV file
$data = Import-Csv .\FakeName.csv;

You will see something like:

GivenName Surname    EmailAddress
--------- -------    ------------
Sara      Gregory    SaraLGregory@rhyta.com
Fe        Haugen     FeTHaugen@superrito.com
Betty     McAllister BettyDMcAllister@teleworm.us
Sandra    Manthey    SandraRManthey@einrot.com
Diana     Rigsby     DianaDRigsby@einrot.com
Gabriel   Rathbun    GabrielMRathbun@armyspy.com
Robin     Francois   RobinCFrancois@cuvox.de
Phillip   Lyons      PhillipILyons@cuvox.de
Henry     Allen      HenryCAllen@superrito.com
Angela    Boyd       AngelaRBoyd@armyspy.com

Then, we need to edit the email addresses and names

$NewData = $data | select @{Name="GivenName"; Expression={$_.GivenName}},`
    @{Name="Surname"; Expression={$_.Surname}},`
    @{Name="UPN"; Expression={$_.EmailAddress -replace "@.*","@contosovlab.com"}}

The result will look like this

GivenName  Surname    UPN
---------  -------    ---
Sara       Gregory    SaraLGregory@contosovlab.com
Fe         Haugen     FeTHaugen@contosovlab.com
Betty      McAllister BettyDMcAllister@contosovlab.com
Sandra     Manthey    SandraRManthey@contosovlab.com
Diana      Rigsby     DianaDRigsby@contosovlab.com
Gabriel    Rathbun    GabrielMRathbun@contosovlab.com
Robin      Francois   RobinCFrancois@contosovlab.com
Phillip    Lyons      PhillipILyons@contosovlab.com
Henry      Allen      HenryCAllen@contosovlab.com
Angela     Boyd       AngelaRBoyd@contosovlab.com

Now that the file is edited, let’s export it to a new CSV file

$NewData | Export-CSV NewFile.csv -NoTypeInformation

EX5_05

Now that we have a NewFile.csv with our test users lets create the mailboxes. Open your Exchange Management Shell, Navigate to the folder where you save the NewFile.csv and run the following cmdlet:

$password = Read-Host "Enter password" -AsSecureString
Import-CSV NewFile.csv | ForEach {New-Mailbox -Alias $_.GivenName -Name ( $_.GivenName + " " + $_.Surname ) -UserPrincipalName $_.UPN -FirstName $_.GivenName -LastName $_.Surname -Password $password}

EX5_06

If your test is successful then try adding more users. You can also try with more options, for example I included the “Country Abbreviation” to the CSV file and replace the abbreviations with the names of some Organizational Units I created on my Active Directory (Italy’s abbreviation is IT which give you an IT department without replacing the name). Then add the -OrganizationalUnit to the cmdlet:

$password = Read-Host "Enter password" -AsSecureString
Import-CSV NewFile.csv | ForEach {New-Mailbox -Alias $_.GivenName -Name ( $_.GivenName + " " + $_.Surname ) -UserPrincipalName $_.UPN -FirstName $_.GivenName -LastName $_.Surname -Password $password -OrganizationalUnit $_.OU}

EX5_07

Sending Emails

Now that we have our users, we need to send some emails. Fortunately “Paul Cunningham” the “Exchange Server Pro” created a script that will do just that: Generate Email Traffic in a Test Lab Environment just follow the instructions shown in his blog and you will be fine. I do recommend you to change the values to send more emails.

I had tested Paul’s script in Exchange Server 2010 and 2013, unfortunately in Exchange 2010 we will need to install a certificate for the script to work. To install a certificate for our test lab the best is to use a self-signed certificate from our own private Certification Authority (CA). First we will need to install Active Directory Certificate Services (AD CS), request a certificate in Exchange server, and create our certificate with the newly installed CA, here you can find the steps to install AD CS, create a certificate and deploy it.

To request a certificate for your Exchange Server open the Exchange Management Shell and run the following command:

New-ExchangeCertificate -FriendlyName "Exchange 2010 Certificate" -IncludeServerFQDN -DomainName vlab08ex.contosovlab.com,autodiscover.contosovlab.com,webmail.contosovlab.com -GenerateRequest -PrivateKeyExportable $true

After you installed the certificate and follow all the steps in Paul’s blog, you can start the Mail Generator script. Open your Exchange Management Shell, navigate to the directory where you saved the script with all the files, and run it.
EX5_08

Note: In Exchange 2010 I still get an error that seems to be a bug. However do not worry about it, the script will still generate emails and send them to random users.
EX5_09

You can keep sending emails for a while just to populate all the mailboxes with some data.

This will conclude part #5 of this Lab. See you in Part #6.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s