Categories
Exchange Microsoft Office 365 PowerShell

How to convert a User Mailbox to a Shared Mailbox in Exchange 2016

So I discovered that there is the right way and the wrong way to create a Shared Mailbox when using Office 365 Exchange Hosted and Exchange 2016 in a Hybrid configuration. So the way I would normally do it would be to migrate the mailbox to Office 365 and then click that pretty little button to convert to a Shared Mailbox.

It turns out that when you do that it will create the mailbox as a shared mailbox, however the Active Directory (AD) Components are non-existent. Which means you cannot assign permissions to users who are synced by AD.

Well…. you can…. but it doesn’t actually work.

So what can we do to make it work when you have a user who is complaining that they need to send out a file at 4:45 PM on a Friday???

Well there is not much that you can do, but I would start with converting the mailbox back to a normal user mailbox and then migrate the mailbox back to your Local Exchange Environment.

Once the migration is complete you can then run the following command to convert a normal user account to a Shared Mailbox on Exchange.

Set-Mailbox AJones -Type shared

Once the command is complete (which is really freaky fast) you will then be able to see the mailbox under the “Shared Mailbox” section in Exchange.

I would then Migrate the mailbox back to Office 365 the way that it is and once it is done you should be good to go.

In the event that you would want to switch the Shared Mailbox back to a normal mailbox, here is the command to switch it back.

Set-Mailbox AJones -Type regular

I hope you found this guide helpful, and if did, please share it with your friends.

Categories
Exchange Microsoft Office 365 PowerShell Windows

How to connect to Exchange Online with PowerShell

I realized that my previous post might have been confusing about how to connect to Exchange Online. So I wanted to do a post on how you can connect to Exchange Online Using PowerShell.

First things first, because some of the scripts that you will need to run are not native to your machine, you will need to run this command, probably as an administrator before you can try to connect.

Set-ExecutionPolicy RemoteSigned

Next you will need to set your login credentials. This account needs to have administrative privileges in Exchange Online for it to Connect:

$UserCredential = Get-Credential

This will bring up a Office 365 login prompt. Enter your username, then your password and when it is done the screen will close and you will be back in PowerShell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Lastly you will need to run this command

Import-PSSession $Session -DisableNameChecking

Which will enable several commands that are now available to you.
I hope that this guide helps you, I know that I always forget how to do this so doing a Blog post should help. 
Please feel free to share with your friends if you think it will help them. 
Categories
Exchange Microsoft Office 365 PowerShell Windows

Office 365 Hybrid – Shared Mailboxes Created in Exchange Online do not appear to users whose mailboxes exist on local Exchange

I have been working on an Hybrid Exchange Solution using Office 365. The Client has several shared mailboxes and I wanted to see if a Shared Mailbox created in Office 365 would appear for users who have not been migrated.

Long Story short, the answer is no, they cannot. The reason for this is actually pretty simple. Anything created in Office 365 is not assigned a GUID by Active Directory (because we are only doing a unidirectional sync) so Exchange does not have any record of it.

 It turns out however, that if you migrate the mailbox to the On Premise Exchange server a GUID can be assigned.

I found this Article on Microsoft’s support site on how to do it:
https://support.microsoft.com/en-us/help/3129334/users-in-a-hybrid-deployment-can-t-access-a-shared-mailbox-that-was-cr

Here is the process that you would need to follow in order to get it to work

Please note, the website says that you do not need to do this if your are running Exchange 2016 CU 10 or later. The Client was running 13 at the time, however these steps did work.

  1. Convert the shared mailbox to a regular mailbox by using the Exchange admin center in Exchange Online. To do this, follow these steps:
    1. Open the Exchange admin center in Exchange Online.
    2. Click recipients, and then click shared.
    3. Select the shared mailbox, and then click Convert.
    4. On the Warning page, select Yes to convert the shared mailbox.
  2. Create an on-premises object for the cloud mailbox by using the New-RemoteMailbox cmdlet in the Exchange Management Shell.

    Note This object must have the same name, alias, and user principal name (UPN) as the cloud mailbox.
  3. Set the ExchangeGuid property on the new on-premises object that you created in step 2 to match the cloud mailbox. To do this, follow these steps:
    1. Connect to Exchange Online by using a remote session of Windows PowerShell.
    2. Use the Get-Mailbox cmdlet to retrieve the value of the ExchangeGuid property of the cloud mailbox. For example, run the following command:

      Get-Mailbox <MailboxName> | FL ExchangeGuid 
    3. Open the Exchange Management Shell on the on-premises Exchange server.
    4. Use the Set-RemoteMailbox cmdlet to set the value of the ExchangeGuid property on the on-premises object to the value that you retrieved in step 3b. For example, run the following command:
      Set-RemoteMailbox <MailboxName> -ExchangeGuid <GUID>
  4. Wait for directory synchronization to occur. Or, force directory synchronization.
  5. Make sure that the Office 365 user object is displayed as “Synced with Active Directory.”
  6. Move the mailbox from Exchange Online to the on-premises environment.
  7. Convert the mailbox to a shared mailbox by using the Set-Mailbox cmdlet in the Exchange Management Shell. For example, run the following command:
    Set-Mailbox <MailboxName> -Type Shared
  8. Move the mailbox from the on-premises environment to Exchange Online.
I hope you found this guide helpful, and if you do please tell your friends.

Office 365 user names with ADSync have the OnMicrosoft.com Domain

So I have been working on a Exchange 2016/Office 365 Hybrid solution. Part of the setup is to install and configure ADSync which depending on the day of the week it could either be a Office 365 or Azure Utility. I have honestly installed this tool several times, and it is never in the same place every time I need to download it.

Once ADSync is installed, It will sync your Local AD Users to Office 365/Azure AD. Depending on how you configure the Sync, it could synchronize the whole AD Forrest, an OU (or Multiple OUs), or a Group. In my case I selected 1 of our OUs.

Within 30 minutes all of my users in that OU were sync’d with Office 365/Azure AD. However all of my users had a @company.OnMicrosoft.com user name. Normally this would not be a problem, however I am sure this would be confusing to some users. I also noticed that the usernames were also not consistent either.  Some of them looked like this:

[email protected]

or

[email protected]

After scouring the internet I found nothing on how to fix this for my users. I was just about to open a ticket with Office 365 Support when I found a Technet Article that talked about how the usernames are generated when using ADSync.

To Paraphrase the article, the username in Office 365 is set by the user’s Alias set in Exchange. Which led me to believe that we really have some inconsistent naming going on at my office but that is for another day.

The Article also covered how to change the user names. This let me to believe that I could use this same method for changing the domain name as well, and it worked!

Here is what you will need to do

Connect to Office 365:

Connect-MsolService

Then use this command:

Set-MsolUserPrincipalName -UserPrincipalName [email protected] -NewUserPrincipalName [email protected]

If you don’t get an error message then you should be able to click the refresh button in Office 365 for the user account and you will see the new name.