禁用在 PowerShell 中调用命令后打印的横幅消息
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 总是在调用该命令时打印此横幅消息。
如何禁止打印它。
我尝试的步骤:
- Piping to Out-Null.
- Assigning to $null.
- Invoking the command with -NoLogo attached
Connect-ExchangeOnline -Credential $Credential -NoLogo
即使到那时也会打印命令横幅。
我无法更改调用 PowerShell 进程的方式,因为存在调用 PowerShell 的包装层。
唯一可以修改的是 PowerShell 脚本。
这没有像 Connect-ExchangeOnline doesn't mention -ShowBanner:$false
switch, as Use the Exchange Online PowerShell V2 module 页面那样记录在案。
要禁用横幅,请将 $false
作为 ShowBanner
开关参数传递。 Exchange cmdlet 是个奇怪的人,因为大多数 cmdlet 只需要开关存在。 Exchange 不是这样,我想知道 five years ago。在 Exchange cmdlet 中,也需要指定开关值。
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 脚本。
这没有像 Connect-ExchangeOnline doesn't mention -ShowBanner:$false
switch, as Use the Exchange Online PowerShell V2 module 页面那样记录在案。
要禁用横幅,请将 $false
作为 ShowBanner
开关参数传递。 Exchange cmdlet 是个奇怪的人,因为大多数 cmdlet 只需要开关存在。 Exchange 不是这样,我想知道 five years ago。在 Exchange cmdlet 中,也需要指定开关值。