Archdeacon
Archdeacon

Reputation: 213

Detect -Debug and -Verbose function parameters in VB.NET

I am using Microsoft Visual Studio 2008 Visual Basic, and am creating a custom PowerShell Cmdlet.

How do I detect if either the -Verbose or -Debug parameters are used? I have tried If Debug.IsPresent Then, but that does not appear to work.

Upvotes: 1

Views: 218

Answers (2)

Lars Truijens
Lars Truijens

Reputation: 43595

It is not VB.Net, but here is a solution in C# which should translate to VB.Net with ease

Upvotes: 0

user189198
user189198

Reputation:

You have to examine the parameters that are passed into the cmdlet. Use the $PSBoundParameters automatic variable to determine which parameters were specified.

For more information, see: Get-Help -Name about_Automatic_Variables;

Upvotes: 1

Related Questions