Not sure I completely understand your question.
However, You should have a look at "Get-help about_functions_advanced": With Advanced functions you can take advantage of the common -verbose parameter. Simply output your verbose output this way:
Write-Verbose "Text of debug"
when the shell's $VerbosePreference variable isn't set to "SilentlyContinue" ("Continue" will enable the output), you'll see your verbose output.
Alternatively you can write your own verbose output for your script and use Write-Verbose for whichever line you require.
The topic ‘Enable Verbose Switch for cmdlets within the Function’ is closed to new replies.