Author Posts

May 7, 2013 at 4:39 am

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" 
{CODE}
$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?

 

May 7, 2013 at 5:03 am

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

May 7, 2013 at 5:28 am

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.

May 7, 2013 at 7:02 am

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.

May 7, 2013 at 8:31 am

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.