【问题标题】:Disable the banner message printed after a command is invoked in PowerShell禁用在 PowerShell 中调用命令后打印的横幅消息
【发布时间】:2020-05-18 07:13:13
【问题描述】:
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 脚本中。

【问题讨论】:

  • -ShowBanner:$false switch 有帮助吗?
  • 它正在工作。谢谢!!!

标签: powershell powershell-remoting


【解决方案1】:

这没有记录,因为Connect-ExchangeOnline 没有提到-ShowBanner:$false 开关,就像Use the Exchange Online PowerShell V2 module 页面一样。

要禁用横幅,请将$false 作为ShowBanner 开关参数传递。 Exchange cmdlet 是一个奇怪的人,因为大多数 cmdlet 只需要交换机存在。 Exchange 并非如此,我想知道five years ago。在 Exchange cmdlet 中,也需要指定开关值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-16
    • 1970-01-01
    • 2016-09-25
    • 2017-08-10
    • 1970-01-01
    • 1970-01-01
    • 2019-10-17
    • 1970-01-01
    相关资源
    最近更新 更多