【问题标题】:How to suppress the ExportedCommands output from Exchange powershell script output如何抑制 Exchange powershell 脚本输出的 ExportedCommands 输出
【发布时间】:2017-01-31 21:47:27
【问题描述】:

我正在尝试使用 powershell 脚本从 Exchange Online 2016 中获取一些信息。这里我使用这个脚本

$UserCredential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $UserCredential -Authentication "Basic" -AllowRedirection
Import-PSSession $ExchangeSession -DisableNameChecking

我得到以下输出:

ModuleType 版本名称 ExportedCommands
---------- -------- ---- ----
脚本 1.0 tmp_avadkvxn.tjc Get-MailboxUsageReport

我的问题是, 我不希望在我的输出中出现上述消息。如何压制这个?我只想要确切的输出。这里我没有提到我使用的命令。在尝试导入会话时,它在控制台中提供此信息消息,如何抑制此

提前致谢,

阿鲁尔

【问题讨论】:

  • 谁能帮帮我
  • Import-PSSession 返回模块对象。重定向该命令的结果应该足够了,例如$null = Import-PSSession ...

标签: powershell exchange-server


【解决方案1】:

尝试使用如下导入命令。

这会起作用:

$null = Import-PSSession

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-19
    • 2016-03-29
    • 2012-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多