Hybrid Management - Part 01 - Creating local User mailboxes

Welcome to my tutorials on Hybrid Exchange - Office 365 Administration -

All Hybrid Administration Tutorials
- How to configure your desktop PC for Hybrid Exchange - Office 365 - Azure Administration - Link
- How to connect to Hybrid Exchange - Office 365 - Azure AD and Local AD via PowerShell - Link
- Hybrid Management - Part 01 - Creating local User mailboxes - Link
- Hybrid Management - Part 02 - Creating local Exchange Shared Mailboxes - Link
- Hybrid Management - Part 03 - Creating local Exchange Room and Equipment Mailboxes - Link
- Hybrid Management - Part 04 - Configure the Hybrid Connection Wizard - Link
- Hybrid Management - Part 05 - Individual mailbox moves via the EAC - Link
- Hybrid Management - Part 06 - Bulk mailbox moves via the EAC - Link
- Hybrid Management - Part 07 - Moving bulk mailboxes with PowerShell - Link
- Hybrid Management - Part 08 - Creating Office 365 User Mailboxes via PowerShell - Link
- Hybrid Management - Part 09 - Creating Office 365 Shared Mailboxes via PowerShell - Link
- Hybrid Management - Part 10 - Creating Office 365 Room and Equipment Mailboxes via PowerShell - Link

---------------------------------------------------------------------------------------------------

Hybrid Management - Part 01 - Creating local User mailboxes

This tutorial will walk you through creating Local Exchange User Mailboxes.
The script is available as part of my Hybrid Office 365 Administration Pack - Download Link

It is critical that you follow the pre-requisites below as my Hybrid connection script is needed to run these Hybrid Management scripts successfully.

----------------------------------------------------------------------------------------------------

Pre-requisites

Preparation Guides
- Follow the guides below to ensure your PC is configured for Hybrid Administration - 
How to configure your desktop PC for Hybrid Exchange - Office 365 - Azure Administration - Link
How to connect to Hybrid Exchange - Office 365 - Azure AD and Local AD via PowerShell - Link

Downloads -
My Hybrid Office 365 Administration Pack - Download Link
My Hybrid Connection Script - Download Link

----------------------------------------------------------------------------------------------------

Preparation to run this script -

Current Local Active Directory -
As you can see in the image below, I have created a logical OU structure to easily manage my AD and Exchange Objects. New User Mailboxes will be created in the following OU - \TeamTerry\Users.
Ensure you have already created a logical OU structure as you will need to enter the OU path in the csv that is used for mailbox creation.

My OU structure below shows that I have created the TeamTerry OU which will hold all my Exchange objects in appropriate sub OUs.

Contacts                                     => holds the Exchange contacts
DistributionGroups                    => holds Distribution Groups
Equipment                                  => holds Equipment mailboxes
Rooms                                        => holds Room mailboxes
SecurityGroups                          => holds Security Groups and mail enabled security groups
Shared                                        => holds Shared mailboxes
Users                                          => holds User mailboxes












Current Local Mailboxes -
As you can see, the only Local Exchange Mailboxes at this point are the local Administrator and six mailboxes that I have created.

Current Exchange Online objects
As no mailboxes have been migrated to Office 365 yet, Exchange Online will only display any 'Cloud Only' mailboxes. In this instance, you can only see the two Cloud Only Administrator account mailboxes.



The Hybrid Connector does however create Exchange Online Contacts which reference the Exchange Local mailboxes. As I have created six local Exchange mailboxes, they show as Exchange Online Contacts when viewing the Office 365 EAC.


---------------------------------------------------------------------------------------------

Editing the csv file with your User Mailbox details

To start creating local Exchange Mailboxes, ensure you have already downloaded the following scripts and csv folders mentioned earlier in the pre-requisites section.
--- Hybrid Connection Script - Download Link
--- Hybrid Office 365 Administration Pack - Download Link

Extract the folders in the Hybrid Office 365 Administration Pack zip file to the folder c:\scripts. Move each of the csv files to the root of c:\scripts.


Edit the LocalUserMailboxes.csv with your data.
See the example below for guidance -



*** Notes for editing the LocalUserMailboxes.csv file ***
The following fields MUST contain data to create a valid mailbox -
- Name                         ( This becomes the Display Name )
- UPN                           ( This becomes the login ID which matches the email address )
- Alias                          ( This must match the start of the email address / UPN)
- OU                             ( This is the Organizational Unit of where you are creating the user)
- Password                   ( This is a temporary password only)





Although that is the minimum that is needed to actually create a mailbox, you would in normal practice use FirstName and LastName for ease of management.

Things to be aware of when updating the spreadsheet for User mailboxes.
Name
- This becomes the Display Name of the user's mailbox

UPN
- This becomes the login ID which needs to match the Primary SMTP address

Alias
- Ensure this matches the start for the email address / UPN

OU
- Ensure the Organisational Unit is correct

Password
- Temporary password only. The script automatically sets the user to change password at next logon.

CustomAttribute1
- This can be used to simplify Enterprise Management - Link

SendAs
- Enter the UPN of the user (or email address of group)) that needs Send As permission to the mailbox

FullAccess
- Enter the UPN of the user (or email address of group) that needs Full Access permission to the mailbox

SendOnBehalf
- Enter the UPN of the user (or email address of group) that needs SendOnBehalf permission to the mailbox

Manager
- Enter the Alias of the Manager (this is usually the UPN without the domain name.
- - Example
- UPN / Email address of the Manager - user.101@teamterry365.com
- Alias of the Manager - user.101

Country
- Note that you must use the two character code for the Country - Link
- - Example -
- AU - Australia
- US - United States

The other fields are plain text fields which are self explanatory
- City
- Company
- Department
- HomePhone
- MobilePhone
- Office
- OfficePhone
- StreetAddress
- State
- PostalCode
- Country
- HomePage
- Fax

Once you have finished creating your csv file, save as C:\Scripts\LocalUserMailboxes.csv

Note that if you would like to save the script in a different location - you can easily edit the script variable as below.

Original script








Updated script with new csv location.









-------------------------------------------------------------------------------------------

Running the scripts for Local Exchange Mailbox creation

Connect to your local Exchange, AD and Azure AD Connect server using this tutorial -
- How to connect to Hybrid Exchange - Office 365 - Azure AD and Local AD via PowerShell - Link

Run the script -
Open PowerShell ISE and connect using my Hybrid Connection script - (see above).
Open the folder - New-LocalUserMailbox - Drag the PowerShell file to ISE ready to run after you have updated the csv file.











Once you have updated your csv, you can simply run the script by clicking the Play arrow.

When the script runs, you will see that it has created the mailboxes.
There will be a two minute delay while it sets delegate permissions if specified.





After the delay, the script will continue and apply the delegate permissions.
The screen will display the delegate permission changes.














Once the permission changes are performed, the script will run a delta update on your Azure AD Connect server.
The script will then advise that the local User Mailboxes have been created and synched to Office 365.







-----------------------------------------------------------------------------------------------------

Confirming creation of mailboxes
Log into the Local Exchange EAC and confirm the creation of the user mailboxes.


You can also confirm the successful setting of delegated permissions by checking the mailboxes.












Now log in to the Office 365 EAC and confirm that Contacts have been created that correspond to the Local Exchange Mailboxes.











----------------------------------------------------------------------------------------------------------

Troubleshooting -
Error -
Set-ADUser : Identity info provided in the extended attribute: 'Manager' could not be resolved. Reason: 'Cannot find an object with identity: username@domain.com

Resolution -
Edit the csv file with alias of the Manager (Usually the start of the email address / UPN without the domain suffix)

Details -
Manager field in the csv file
- Enter the Alias of the Manager (this is usually the UPN without the domain name.)
- - Example
- UPN / Email address of the Manager - user.101@teamterry365.com
- Alias of the Manager - user.101

*** Note - A similar error will appear if you try to add a Manager or Delegate that does not exist ***

-----------------------------------------------------------------------------------------------------------

Troubleshooting -
Error -
Organizational unit "internal.domain.com/Company/Users" was not found. Please make sure you have typed it correctly.

Resolution - 
Edit the csv to have the correct path of the OU (Organizational Unit) that you need the User mailboxes to be created in.

No comments:

Post a Comment