简体   繁体   中英

How to suppress the ExportedCommands output from Exchange powershell script output

I am trying to get some information from exchange online 2016 using powershell script. Here I'm using this script

$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

and I'm getting following output:

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0 tmp_avadkvxn.tjc Get-MailboxUsageReport

My question is, I don't want this above message in my output. how to suppress this? I want only the exact output. Here I didn't mention the command what I have used. While trying to import the session its giving this information message in console, how to suppress this

Thanks in advance,

Arul

Try to use import command as below.

This will work:

$null = Import-PSSession

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM