Common parameters

With CmdletBinding in place, a script or function may use common parameters. The common parameters are listed in PowerShell's help file:

Get-Help about_commonparameters

For example, the Verbose parameter is made available. Any verbose output written by the command will be displayed without the need to explicitly declare the Verbose parameter within the function:

function Show-Verbose {
[CmdletBinding()]
param ( )

Write-Verbose 'Verbose message'
}

The verbose message will be displayed when the command is run with the -Verbose parameter.

In a similar way, parameters such as ErrorAction will effect Write-Error if it is used within the function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.146.223