禁用在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总是打印此横幅消息。 如何禁用此功能以使其无法打印。

我尝试的步骤:

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

即使这样,命令标题也会被打印出来。

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

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

评论