2016-09-23 72 views
0

我想从使用PowerShell脚本的在线交流2016获取一些信息。在这里我使用这个脚本如何禁止Exchange的ExportedCommands输出powershell脚本输出

$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获取-MailboxUsageReport

我的问题是, 我不想在这上面的消息我输出。如何抑制这一点?我只想要确切的输出。在这里我没有提到我用过的命令。试图导入其在控制台给这个信息的消息,如何提前抑制这种

感谢,

了Arul

+0

任何一个可以帮我请 – Arulmurugan

+0

'进口PSSession'返回模块对象。重定向该命令的结果应该足够了,例如, '$ null = Import-PSSession ...' – BartekB

回答

0

尝试如下使用导入命令的会话。

这将工作:

$null = Import-PSSession