Search code examples
powershelloffice365exchange-server

Stop output when connecting to Exchange Online in PowerShell


I'm currently building an Office 365 PowerShell application that connects to Exchange Online using:

Connect-ExchangeOnline

And while it works just fine, there is one small, insignificant, but annoying occurrence when connecting to a tenancy - the following output is displayed:

----------------------------------------------------------------------------
We have released new management cmdlets which are faster and more reliable.

|--------------------------------------------------------------------------|
|    Old Cmdlets                    |    New/Reliable/Faster Cmdlets       |
|--------------------------------------------------------------------------|
|    Get-CASMailbox                 |    Get-EXOCASMailbox                 |
|    Get-Mailbox                    |    Get-EXOMailbox                    |
|    Get-MailboxFolderPermission    |    Get-EXOMailboxFolderPermission    |
|    Get-MailboxFolderStatistics    |    Get-EXOMailboxFolderStatistics    |
|    Get-MailboxPermission          |    Get-EXOMailboxPermission          |
|    Get-MailboxStatistics          |    Get-EXOMailboxStatistics          |
|    Get-MobileDeviceStatistics     |    Get-EXOMobileDeviceStatistics     |
|    Get-Recipient                  |    Get-EXORecipient                  |
|    Get-RecipientPermission        |    Get-EXORecipientPermission        |
|--------------------------------------------------------------------------|

To get additional information, run: Get-Help Connect-ExchangeOnline
Please send your feedback and suggestions to [email protected]
----------------------------------------------------------------------------

It's not a huge deal and has absolutely no effect on the functionality of my application.. it's just a bit of an eyesore and I'm a bit of a self confessed perfectionist! Is there any way to suppress this output? Casting to null doesn't seem to work and I'm not able to find anything anywhere else as to what may do the trick.

Many thanks in advance!


Solution

  • Depending on your module version, try to add the -ShowBanner:$false switch (source):

    Connect-ExchangeOnline -ShowBanner:$false
    

    Another possibility might be to add HideBannermessage=true as a parameter to your URI (source):

    Connect-ExchangeOnline -ConnectionUri "https://outlook.office365.com/powershell-liveid/?HideBannermessage=true"