Skip to main content

How to: Pulling Exchange Settings From Office 365 Using Powershell

By November 27, 2017August 5th, 2022Blog, Exchange, Microsoft, Office 365
Microsoft PowerShell icon

 

This document describes the process of grabbing all mailbox settings from Office 365 Exchange. We use this process a lot for troubleshooting on the back end.

Starting Session with O365:

  1. Open up the Azure active directory module PowerShell instance.
  2. Store credentials in an object:
    PS C:\WINDOWS\system32> $UserCredential = Get-Credential
    
    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    Credential
    PS C:\WINDOWS\system32>
    
  3. Create session object, utilizing credentials:
    PS C:\WINDOWS\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.of
    fice365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    PS C:\WINDOWS\system32>
    
  4. Now import session
    PS C:\WINDOWS\system32> Import-PSSession $Session
    WARNING: The names of some imported commands from the module 'tmp_ibt3qgi3.fcu' include unapproved verbs that might
    make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the
    Verbose parameter. For a list of approved verbs, type Get-Verb.
    
    ModuleType Version    Name                                ExportedCommands
    -------— ----—    -—                                -------------—
    Script     1.0        tmp_ibt3qgi3.fcu                    {Add-AvailabilityAddressSpace, Add-DistributionGroupMember...
    

Get Mailbox Settings for User:

  • Just check to make sure that box exists
  • Office 365 mailbox powershell ScriptPull all mailbox attributes by piping to field list (otherwise most will be hidden)Pull Mailbox Attributes Powershel Script
  • Pulling Mailbox settings for Universal Messaging (Voicemail):
    PS C:\WINDOWS\system32> Get-UMMailbox -Identity $User_SIP_Address | fl
    
    
    RunspaceId                        : 0cc44215-d538-48d1-b1f3-80e80f1a2b69
    DisplayName                       : $Full_Name
    EmailAddresses                    : {eum:1111;phone-context=4-digit-plan.6cd0fac6-83bf-47c1-acff-f776a07bb8cb,
    ...
    
  • Pull junk email settings for the given user
    PS C:\WINDOWS\system32> Get-MailboxJunkEmailConfiguration -identity $User_SIP_Address
    
    
    RunspaceId                  : 0cc44215-d538-48d1-b1f3-80e80f1a2b69
    Status                      : IsPresent, IsEnabled
    Enabled                     : True
    TrustedListsOnly            : False
    ContactsTrusted             : True
    TrustedSendersAndDomains    : {}
    BlockedSendersAndDomains    : {}
    TrustedRecipientsAndDomains : {}
    ...

Max Fuller, PEI

Leave a Reply