I have seen this used, though I personally have not needed it. Yet, this has been a use for a while now for some.
See this discussion from an archive of stuff I keep around.
How to convert parameter type into a different object type
I’m doing some scripting in PowerShell, and I was wondering if there’s a way to “declare” a parameter “X” the same way parameter “-Credential” is declared, for example in Get-WMIObject cmdlet.
Let me be more specific. The Credential parameter in almost all cmdlets is a PSCredential Object. But, the argument can be either a PSCredential Object or, a String Object with the username.
When the Credential parameter is PSCredential, you cannot pass a string to it: get-something -cred adi, you'll get a ' Cannot process argument transformation' error. using the 'Credential()' transformation solves this. Now you can do 'get-something -cred adi' and the have the credential dialog invoked and populated with the username.