<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hybrid Exchange Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/hybrid-exchange/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/hybrid-exchange/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Wed, 22 Jul 2020 20:03:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>How to Create O365 Mailboxes in Hybrid Exchange</title>
		<link>https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/</link>
					<comments>https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Sat, 12 May 2018 18:58:26 +0000</pubDate>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Exchange Online]]></category>
		<category><![CDATA[Office365]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Create O365 Mailboxes]]></category>
		<category><![CDATA[Create O365 Mailboxes in Powershell]]></category>
		<category><![CDATA[Create O365 Mailboxes in the GUI]]></category>
		<category><![CDATA[Hybrid Exchange]]></category>
		<category><![CDATA[New-RemoteMailbox]]></category>
		<category><![CDATA[O365-NewUserAccountCreation]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=472</guid>

					<description><![CDATA[<p>So you&#8217;re looking to create O365 Mailboxes in Hybrid Exchange, right? As more and more companies move over the to the cloud it&#8217;s absolutely essential to keep operations moving along seamlessly.  If you&#8217;re one of those companies that just migrated&#8230; <a href="https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/">How to Create O365 Mailboxes in Hybrid Exchange</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>So you&#8217;re looking to create O365 Mailboxes in Hybrid Exchange, right? As more and more companies move over the to the cloud it&#8217;s absolutely essential to keep operations moving along seamlessly.  If you&#8217;re one of those companies that just migrated over to Office 365, congratulations!  Having a hosted exchange will hopefully free up some time since you&#8217;re no longer patching, maintaining or upgrading the bulk of the servers that keep this critical service up and running.  The question that many new people seem to have after migrating to O365 is&#8230;  How do I create a mailbox for a new user when I&#8217;m using a hybrid exchange.  The quick answer my friend is: <strong>New-RemoteMailbox</strong>&#8211; In this article I&#8217;m going to go over both the GUI method and the Powershell way to creating user accounts with office 365.  Hopefully this will clear up some question you may have.</p>
<p>&nbsp;</p>
<p>As someone who has managed a hybrid exchange for several years now I can tell you from personal experience I had a lot of questions that needed answers, and my google-fu wasn&#8217;t always on point.  So if you get frustrated, no worries.  It happens and it&#8217;s part of the job. Luckily I was able to learn from my mistakes through trial and error and share them now, with you.  So, there are basically two ways of creating the accounts,  the user-friendly GUI, and the Powershell way (I love the Powershell way because it makes for easy automation.)</p>
<p><em>Before continuing, I am going to assume you have the permissions to create these accounts and exchange mailboxes.  If you need help assigning these permissions, be sure to leave a comment I&#8217;ll do my best to assist.</em></p>
<h2>Create O365 Mailboxes in the GUI:</h2>
<ul>
<li>Login to your On-Premise exchange server with the proper credentials. (Normally it would be something like:  https://&lt;your-onprem-exchange-server.domain.com&gt;/ecp</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/05/Create-O365-Mailboxes.png" target="_blank" rel="noopener noreferrer"><img fetchpriority="high" decoding="async" class="aligncenter wp-image-473 size-medium" src="https://thesysadminchannel.com/wp-content/uploads/2018/05/Create-O365-Mailboxes-1024x455.png" alt="Create O365 Mailboxes" width="1024" height="455" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/05/Create-O365-Mailboxes-1024x455.png 1024w, https://thesysadminchannel.com/wp-content/uploads/2018/05/Create-O365-Mailboxes-768x341.png 768w, https://thesysadminchannel.com/wp-content/uploads/2018/05/Create-O365-Mailboxes.png 1066w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<ul>
<li>Next, under <strong>Recipients -&gt; Mailboxes</strong> you should see the <strong>&#8220;+&#8221;</strong> symbol with a drop down for <strong>Office 365 Mailbox</strong>.</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/05/Office-365-Mailbox.png" target="_blank" rel="noopener noreferrer"><img decoding="async" class="aligncenter wp-image-474 size-full" src="https://thesysadminchannel.com/wp-content/uploads/2018/05/Office-365-Mailbox.png" alt="Office 365 Mailbox" width="729" height="293" /></a></p>
<ul>
<li>Fill out the user information as you normally would.</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/05/New-Office-365-Mailbox.png" target="_blank" rel="noopener noreferrer"><img decoding="async" class="aligncenter wp-image-475 size-full" src="https://thesysadminchannel.com/wp-content/uploads/2018/05/New-Office-365-Mailbox.png" alt="New Office 365 Mailbox" width="582" height="609" /></a></p>
<ul>
<li>Now you can either wait until the next AD Sync cycle runs or you can manually force the sync so your user shows up in Office 365.</li>
<li>To manually force the sync cycle, login to your AD Connect server and open a Administrative Powershell window.
<ul>
<li>Type in <strong>Start-ADSyncSyncCycle -PolicyType Delta</strong></li>
</ul>
</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/05/Start-ADSyncSyncCycle-PolicyType-Delta.png" target="_blank" rel="noopener noreferrer"><img decoding="async" class="aligncenter wp-image-476 size-full" src="https://thesysadminchannel.com/wp-content/uploads/2018/05/Start-ADSyncSyncCycle-PolicyType-Delta.png" alt="Start-ADSyncSyncCycle -PolicyType Delta" width="877" height="391" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/05/Start-ADSyncSyncCycle-PolicyType-Delta.png 877w, https://thesysadminchannel.com/wp-content/uploads/2018/05/Start-ADSyncSyncCycle-PolicyType-Delta-768x342.png 768w" sizes="(max-width: 877px) 100vw, 877px" /></a></p>
<ul>
<li>Now that you&#8217;ve run the ADSync, browse on over to <strong>https://portal.office.com/adminportal/home#/homepage</strong></li>
<li>In the search you should be able to see the user you just created after typing in the name. Click on that user and select <strong>Product Licenses</strong>.</li>
<li>Assign the appropriate license for your org.</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/05/Office365-Available-Licenses.png" target="_blank" rel="noopener noreferrer"><img decoding="async" class="aligncenter wp-image-477 size-full" src="https://thesysadminchannel.com/wp-content/uploads/2018/05/Office365-Available-Licenses.png" alt="Office365 Available Licenses" width="526" height="268" /></a>Once you have assigned the Office 365 license you&#8217;re all set. However, this doesn&#8217;t scale too well and there&#8217;s a lot of point and clicking so the GUI way is not my preferred method.</p>
<p>&nbsp;</p>
<h2>Create O365 Mailboxes in Powershell:</h2>
<p>Just copy the contents of this script to any location on your hard drive.. Then run the file in a Administrative Powershell window.<br />
&nbsp;</p>
<pre class="brush: powershell; title: ; notranslate">

#requires -Module ActiveDirectory
#requires -RunAsAdministrator
#Import-Module ActiveDirectory -EA Stop
 
&lt;#
.Synopsis
    This will create a user with a mailbox in Office365 in Hybrid Exchange.
    For updated help and examples refer to -Online version.
  
 
.DESCRIPTION
    Used to create user accounts in Exchange hybrid mode.
    For updated help and examples refer to -Online version.
 
 
.NOTES  
    Name: O365-NewUserAccountCreation
    Author: The Sysadmin Channel
    Version: 1.01
    DateCreated: 2017-Apr-09
    DateUpdated: 2017-Apr-09
 
.LINK
    https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/ -
 
 
.EXAMPLE
    For updated help and examples refer to -Online version.
 
#&gt;
 
 
$Creds = Get-Credential
$ExchangeServer = Read-Host &quot;Enter in the FQDN for your OnPrem exchange server.&quot;
 
 
Write-Output &quot;Importing Active Directory Module&quot;
Import-Module ActiveDirectory
Write-Host &quot;Done...&quot;
Write-Host
Write-Host
 
 
Write-Output &quot;Importing OnPrem Exchange Module&quot;
$OnPrem = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$ExchangeServer/powershell -Credential $Creds
Import-PSSession $OnPrem | Out-Null
Write-Host &quot;Done...&quot;
Write-Host
Write-Host
 
 
Sleep 4
cls
Write-Host &quot;Before we create the account&quot;
$CopyUser = Read-Host &quot;Would you like to copy from another user? (y/n)&quot;
Write-Host
 
    Do {
        if ($CopyUser -ieq 'y') {
         $CUser = Read-Host &quot;Enter in the USERNAME that you would like to copy FROM&quot;
         Write-Host
 
         
            Write-Host &quot;Checking if $CUser is a valid user...&quot; -ForegroundColor:Green
            If ($(Get-ADUser -Filter {SamAccountName -eq $CUser})) {
            Write-Host &quot;Copying from user account&quot; (Get-ADUser $CUser | select -ExpandProperty DistinguishedName)
            Write-Host
 
            $Proceed = Read-Host &quot;Continue? (y/n)&quot;
            Write-Host
 
 
                if ($Proceed -ieq 'y') {
                    $CUser = Get-ADUser $CUser -Properties *
                    $Exit = $true
                }
 
            } else {
            Write-Host &quot;$CUser was not a valid user&quot; -ForegroundColor:Red
            Sleep 4
            $Exit = $false
            cls
            }
 
        } else {
        $Exit = $true
        }
 
    } until ($Exit -eq $true)
 
 
 
 
cls
Write-Host &quot;Gathering information for new account creation.&quot;
Write-Host
$firstname = Read-Host &quot;Enter in the First Name&quot;
Write-Host
$lastname = Read-Host &quot;Enter in the Last Name&quot;
Write-Host
$fullname = &quot;$firstname $lastname&quot;
#Write-Host
$i = 1
$logonname = $firstname.substring(0,$i) + $lastname
#Write-Host
#$EmployeeID = Read-Host &quot;Enter in the Employee ID&quot;
#Write-Host
$password = Read-Host &quot;Enter in the password&quot; -AsSecureString
 
$domain = Get-WmiObject -Class Win32_ComputerSystem | select -ExpandProperty Domain
 
$server = Get-ADDomain | select -ExpandProperty PDCEmulator
 
    if ($CUser)
    {
    #Getting OU from the copied User.
        $Object = $CUser | select -ExpandProperty DistinguishedName
        $pos = $Object.IndexOf(&quot;,OU&quot;)
        $OU = $Object.Substring($pos+1)
 
 
    #Getting Description from the copied User.
        $Description = $CUser.description
 
    #Getting Office from the copied User.
        $Office = $CUser.Office
 
    #Getting Street Address from the copied User.
        $StreetAddress = $CUser.StreetAddress
 
    #Getting City from copied user.
        $City = $CUser.City
 
    #Getting State from copied user.
        $State = $CUser.State
 
    #Getting PostalCode from copied user.
        $PostalCode = $CUser.PostalCode
 
    #Getting Country from copied user.
        $Country = $CUser.Country
     
    #Getting Title from copied user.
        $Title = $CUser.Title
 
    #Getting Department from copied user.
        $Department = $CUser.Department
 
    #Getting Company from copied user.
        $Company = $CUser.Company
 
    #Getting Manager from copied user.
        $Manager = $CUser.Manager
 
    #Getting Membership groups from copied user.
        $MemberOf = Get-ADPrincipalGroupMembership $CUser | Where-Object {$_.Name -ine &quot;Domain Users&quot;}
 
 
    } else {
    #Getting the default Users OU for the domain.
        $OU = (Get-ADObject -Filter 'ObjectClass -eq &quot;Domain&quot;' -Properties wellKnownObjects).wellKnownObjects | Select-String -Pattern 'CN=Users'
        $OU = $OU.ToString().Split(':')[3]
 
    }
 
 
cls
Write-Host &quot;=======================================&quot;
Write-Host
Write-Host &quot;Firstname:      $firstname&quot;
Write-Host &quot;Lastname:       $lastname&quot;
Write-Host &quot;Display name:   $fullname&quot;
Write-Host &quot;Logon name:     $logonname&quot;
Write-Host &quot;Email Address:  $logonname@$domain&quot;
Write-Host &quot;OU:             $OU&quot;
 
 
DO
{
If ($(Get-ADUser -Filter {SamAccountName -eq $logonname})) {
        Write-Host &quot;WARNING: Logon name&quot; $logonname.toUpper() &quot;already exists!!&quot; -ForegroundColor:Green
        $i++
        $logonname = $firstname.substring(0,$i) + $lastname
        Write-Host
        Write-Host
        Write-Host &quot;Changing Logon name to&quot; $logonname.toUpper() -ForegroundColor:Green
        Write-Host
        $taken = $true
        sleep 4
    } else {
    $taken = $false
    }
} Until ($taken -eq $false)
$logonname = $logonname.toLower()
Sleep 3
 
cls
Write-Host &quot;=======================================&quot;
Write-Host
Write-Host &quot;Firstname:      $firstname&quot;
Write-Host &quot;Lastname:       $lastname&quot;
Write-Host &quot;Display name:   $fullname&quot;
Write-Host &quot;Logon name:     $logonname&quot;
Write-Host &quot;Email Address:  $logonname@$domain&quot;
Write-Host &quot;OU:             $OU&quot;
Write-Host
Write-Host
 
Write-Host &quot;Continuing will create the AD account and O365 Email.&quot; -ForegroundColor:Green
Write-Host
$Proceed = $null
$Proceed = Read-Host &quot;Continue? (y/n)&quot;
 
    if ($Proceed -ieq 'y') {
         
        Write-Host &quot;Creating the O365 mailbox and AD Account.&quot;
        New-RemoteMailbox -Name $fullname -FirstName $firstname -LastName $lastname -DisplayName $fullname -SamAccountName $logonname -UserPrincipalName $logonname@$domain -PrimarySmtpAddress $logonname@$domain -Password $password -OnPremisesOrganizationalUnit $OU -DomainController $Server
        Write-Host &quot;Done...&quot;
        Write-Host
        Write-Host
        Sleep 5
 
 
        Write-Host &quot;Adding Properties to the new user account.&quot;
        Get-ADUser $logonname -Server $Server | Set-ADUser -Server $Server -Description $Description -Office $Office -StreetAddress $StreetAddress -City $City -State $State -PostalCode $PostalCode -Country $Country -Title $Title -Department $Department -Company $Company -Manager $Manager -EmployeeID $EmployeeID
        Write-Host &quot;Done...&quot;
        Write-Host
        Write-Host
 
        if ($MemberOf) {
            Write-Host &quot;Adding Membership Groups to the new user account.&quot;
            Get-ADUser $logonname -Server $Server  | Add-ADPrincipalGroupMembership -Server $Server -MemberOf $MemberOf
            Write-Host &quot;Done...&quot;
            Write-Host
            Write-Host
        }
    }
 
 
Get-PSSession | Remove-PSSession

</pre>
<p>And there you have it,  your account is now created in Office 365 with a brand new mailbox.  You will still need to apply a license to the user account in order to retain the mailbox and keep it active.</p>
<p>Hopefully this article was able to clear up some questions and automate the creation of Office 365 mailbox in Hybrid Exchange.  If you would like more awesome sysadmin content, be sure to check out our <a href="https://www.youtube.com/channel/UC9VnUjmZrNG3ithDZmG-S-g" rel="noopener noreferrer" target="_blank">Youtube Channel</a> for video demos and other cool sysadmin stuff.</p>
<p>The post <a href="https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/">How to Create O365 Mailboxes in Hybrid Exchange</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/how-to-create-o365-mailboxes-hybrid-exchange/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">472</post-id>	</item>
	</channel>
</rss>
