Today With PowerShell – Saturday 22nd October 2016

Whilst creating a script I wanted to be able to trace what was happening as the script ran. In my VBScript days I would have set up a flag to determine if I needed verbose output and then tested for it. Even with cut and paste this can be laborious. In PowerShell we have Write-Verbose, but how do we turn it on? The -Verbose parameter is one of the PowerShell ‘Common Parameters’. To enable these we need a [CmdletBinding()] line as the first executable line in our script.

Have a look at PowerShell – Using Common Parameters for a great overview.

This entry was posted in PowerShell. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s