The information at https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_outputtypeattribute?view=powershell-7.3 is helpful. Also, https://stackoverflow.com/a/57478857/447901 is helpful. But, the only examples given are predefined PowerShell types. I need to define my own object, not just a simple [string]
.
[CmdletBinding()]
param (
[OutputType ???]
)
[PSCustomObject]@{
FirstName = 'Bill'
LastName = 'Smith'
}
I tried creating a class
, but could not get that to work.
class Person {
[string]$FirstName
[string]$LastName
}