AJain2810
AJain2810

Reputation: 435

Disable the banner message printed after a command is invoked in PowerShell

PS C:\Windows\system32> Connect-ExchangeOnline -Credential $Credential | Out-Null

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 |
etc.
|--------------------------------------------------------------------------|

Connect-ExchangeOnline always prints this banner message whenever the command is invoked. How to disable this from getting printed.

Steps I tried:

- Piping to Out-Null.
- Assigning to $null.
- Invoking the command with -NoLogo attached
        Connect-ExchangeOnline -Credential $Credential -NoLogo

The command banner is getting printed even then.

I cannot change the way the PowerShell process is getting invoked as there is a wrapper layer that is calling the PowerShell.

The only modification that can be made is in the PowerShell script.

Upvotes: 1

Views: 3299

Answers (1)

vonPryz
vonPryz

Reputation: 24071

This is poorly documented, as Connect-ExchangeOnline doesn't mention -ShowBanner:$false switch, as Use the Exchange Online PowerShell V2 module page does.

To disable the banner, pass $false as ShowBanner switch parameter. Exchange cmdlets are the odd man out there, as most cmdlets just require the switch presence. Not so with Exchange, which I wondered about five years ago. In Exchange cmdlets, switch values need to be specified too.

Upvotes: 4

Related Questions