PSCustomObject

PSCustomObject Using Select-Object

A traditional way of creating a PSCustomObject is as follows… $Emp = [pscustomobject] @{ Name = '' Department = '' Designation = '' } $Emp Output: Name Department Designation ---- ---------- ----------- Check the object type C:\> $Emp.GetType().Name Output: PSCustomObject And using Select-Object it is quite simple… $Emp = '' | Select-Object -Property Name, Department, Designation $Emp Output: Name Department Designation ---- ---------- ----------- Check the object type C:\> $Emp.GetType().Name Output: PSCustomObject


28 January 2020