Supressing verbose for certain commands when using the verbose paramter?

I generally like to use write-verbose statements as a form of documentation and troubleshooting when working on a script. But some commands like get-mailbox produce more verbose output then I would like and it makes searching for the write-verbose statements I specified difficult. I’ve tried setting the verbose preference manually before and after a get-mailbox command:

$VerbosePreference = "SilentlyContinue" 
$VerbosePreference = "Continue"

 And using the –verbose paramter for get-mailbox (-Verbose:$false)

$CurrentMailBoxPolicy = (Get-mailbox $CurrentUser -Verbose:$false).ManagedFolderMailboxPolicy

but I still get around 7 lines of verbose messages (which is less than if I didn’t set either verbose method). Is this just how these cmdlets work or is there something I can do to surpress these messages when I want verbose output from everything else in the script?


Try explicitly setting -Verbose:$False on the cmdlets you want to suppress that output for.

I’ve tried that with get-mailbox (see the example in the inital post) and while it does reduce the amount of verbose messages it still produces around 7 lines worth.

Is that a Exchange EMS environment, or are you importing an Exchange management session and using implicit remoting? In an implicit remoting session what you’re actually getting are proxy functions, and I’ve noticed that sometimes the common paramters don’t work like you expect them to with those proxy functions.

Rob, thanks for the reply. I am importing the session which and your explanation is more than likely what is happening. So I guess the verbose messages I’m getting are actually from the proxying of the cmdlets and not the cmdlets themselves. Which would explain why I can reduce some of the verbose output but not all of it.