Skip to content

/flags/exchange-online/connect-exchangeonline-showbanner-false

Connect-ExchangeOnline -ShowBanner:$false: hide the connection banner

The commands on this page have not been executed by our verification runner yet.updated
tool
Exchange Online PowerShell
command
Connect-ExchangeOnline
flag
-ShowBanner:$false
default
banner shown

Connect-ExchangeOnline -ShowBanner:$false connects without printing the welcome banner that the ExchangeOnlineManagement module shows on every connection (module notes, links, and the hint about Get-ConnectionInformation). Use it in scripts, scheduled tasks and logs, where the banner is noise. The reference: "To show the banner, you don't need to use this switch (the banner is displayed by default). To hide the banner, use this exact syntax: -ShowBanner:$false."

powershell
Connect-ExchangeOnline -UserPrincipalName admin@contoso.com -ShowBanner:$false
Connect-ExchangeOnline -AppId $appId -CertificateThumbprint $thumb -Organization contoso.onmicrosoft.com -ShowBanner:$false

Why the colon matters

-ShowBanner is a switch parameter, on by default in this cmdlet. A switch is set to false only with the colon syntax. With a space, PowerShell treats $false as a separate positional value.

So Connect-ExchangeOnline -ShowBanner $false binds $false to -ConnectionUri (position 0) instead of turning the banner off. Always write -ShowBanner:$false.

Other switches for quiet scripts

ParameterEffect
-ShowBanner:$falseno banner
-ShowProgress $falseno progress bar while cmdlets page through results (a Boolean, so a space is fine)
-CommandName Get-EXOMailbox,Set-Mailboxload only these cmdlets: faster connection, smaller memory footprint
-SkipLoadingFormatDataskip format data; output is unformatted, useful in services
-DisableWAMturn off Web Account Manager sign-in (module 3.7.2 and later)

Pitfalls

  • Switch syntax. As shown, only the colon form works. The same rule applies to every switch parameter in PowerShell, for example -Confirm:$false.
  • Banner is not the error. If the connection fails, the error is still printed; hiding the banner does not hide failures.
  • Check the session. Without the banner, confirm the connection with Get-ConnectionInformation. Cmdlets run before it fails with You must call Connect-ExchangeOnline.
  • Unattended sign-in. A quiet script also needs non-interactive authentication; see certificate app-only authentication. For servers without a browser in PowerShell 7, see -Device.

FAQ

Why does -ShowBanner $false (with a space) fail?

ShowBanner is a switch parameter, so PowerShell does not take the next token as its value. $false becomes a positional argument for the first positional parameter, ConnectionUri, and the connection goes to a wrong endpoint or fails. Write -ShowBanner:$false with a colon.

Does Connect-IPPSSession have the same switch?

Yes. Connect-IPPSSession also has -ShowBanner, and Connect-IPPSSession -ShowBanner:$false hides its banner in the same way.

Does hiding the banner change the session?

No. The banner is only informational text about the module and its cmdlets. The session, its cmdlets and its permissions are the same.

Sources