A play on the film title from “Dude, where’s my car?” in which, well actually, we can’t remember the plot but we do remember the title and something about a scene with tattoos.
Putting movies to one side, customers often want to know where their mailboxes reside in Office 365 and Exchange Online. If my billing address is in Europe I can assume my data centres are located in Dublin and Amsterdam but can I verify that? Also, the mailboxes for individual users and resources might be in either of those locations. Here’s where a little PowerShell comes in handy.
There’s a useful getting started with Powershell resource on the Microsoft website. You can also search the web for myriad explanations but be aware many of these will be out of date especially if you’re using Windows 8.1.
Windows 8.1 includes PowerShell by default so on the Start screen, type PowerShell, right-click Windows PowerShell in the search results and select Run as Administrator. I’ll explain why you need to run it as admin in a moment.
So many memories of the old DOS window. PowerShell doesn’t speak Office 365 by default so we have to teach it by installing the Windows PowerShell cmdlets for Office 365 management and deployment. Your keyboard should now be bristling with all the power you have at your fingertips.
1 – Set the PowerShell execution policy. The default setting for execution policy is restricted which would not allow PowerShell to run scripts at all; secure but not very useful. RemoteSigned tells PowerShell it can run scripts on the local machine but any scripts downloaded from the Internet must be signed by a trusted publisher. This is also why you need to run PowerShell as administrator; in order to change this setting.
2 – Set your Office 365 admin credentials. A popup window will appear where you type in your Office 365 admin user and password. This will also tell the PowerShell cmdlets which Office 365 tenant you want to connect to.
$cred = Get-Credential
3 – In order to perform administrative tasks on Office 365 you can connect to the online service using the credentials you supplied.
Connect-MsolService -cred $cred
4 – You can list all the Office 365 admin commands. Note that Exchange, SharePoint and the other cloud services have their own set of commands.
Get-Command –Module msonline
5 – To connect to Exchange Online, type the following commands. You don’t need to change anything here; again, the tenant to connect to is specified by the login ID in the credentials.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
6 – Return your mailbox information to see where they’re located. If the server name begins with db you’re in Dublin and if it’s am you’re in Amsterdam. Happy travels!