Recursive -Verbose in Powershell


Is there an easy way to make the -Verbose switch “passthrough” to other function calls in Powershell?

I know I can probably search $PSBoundParameters for the flag and do an if statement:

It seems rather messy and redundant to do it this way however… Thoughts?


One way is to use $PSDefaultParameters at the top of your advanced function:

Then every command you invoke with a -Verbose parameter will have it set depending on whether or not you used -Verbose when you invoked your advanced function.

If you have just a few commands the do this:


Recursive -Verbose in Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply