Main | Contact | Blog | Documentation

PowerShell Framework

The project dedicated to empowering your PowerShell scripting.

Getting started with Parameter Classes

Parameter Classes enable developers to be more permissive in what input they accept and does all the input interpretation for the developer.

Implementing Parameter Classes

Parameter classes define new types as input types. In many instances, implementing them is as simple replacing the expected type on the parameter definition:

[CmdletBinding()]
param (
    [string]
    $ComputerName
)

would become

[CmdletBinding()]
param (
    [PSFComputer]
    $ComputerName
)

With this your command will correctly understand dns resolution objects, the output of Get-ADComputer, connection strings or any of a dozen other legal input types.

Additional Information

Further reading