禁用在PowerShell中调用命令后显示的标题消息

问题描述 投票:0回答:1
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总是在调用命令时打印此横幅消息。如何禁止其打印。

我尝试过的步骤:

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

即使到那时,命令横幅仍会被打印。

我无法更改PowerShell进程的调用方式,因为有一个包装层正在调用PowerShell。

唯一可以进行的修改是在PowerShell脚本中。

powershell powershell-remoting
1个回答
0
投票
此文档记录不佳,因为Connect-ExchangeOnline没有像-ShowBanner:$false页面那样提及Use the Exchange Online PowerShell V2 module开关。

要禁用标题,请将$false作为ShowBanner开关参数传递。 Exchange cmdlet很奇怪,因为大多数cmdlet都只需要交换机存在。对于Exchange,情况并非如此,我对five years ago感到疑惑。在Exchange cmdlet中,也需要指定开关值。

© www.soinside.com 2019 - 2024. All rights reserved.