PowerShell provides a variety of different ways to tightly define the content for a parameter. Assigning a .NET type to a parameter is the first of these. If a parameter is set as [String], it will only ever hold a value of that type. PowerShell will attempt to coerce any values passed to the parameter into that type.
Validating input
The PSTypeName attribute
It is not uncommon in PowerShell to want to pass an object created in one command, as a PSObject (or PSCustomObject), to another. The PSTypeName attribute is able to test the type name assigned to a custom object. Type names are assigned by setting (or adding) a value to the hidden PSTypeName property. There are a number of ways to tag PSCustomObject with a type name...