Hello,
Hereunder a little reminder about how to create object in all version of PowerShell :
PowerShell 1
#PowerShell v1 $Computer = "" | select Name, State, OS $Computer.Name = "Localhost" $Computer.State = "Unknown" $Computer.OS = "Unknown" $Computer
PowerShell 2
#PowerShell v2 $Computer = New-Object -TypeName PSObject -Property @{Name = "Localhost"; State = "Unknown"; OS = "Unknown"} $Computer
PowerShell 3
#PowerShell v3 [PsCustomObject]@{Name = "Localhost"; State = "Unknown"; OS = "Unknown"}
If you look at performances :
Please upgrade to the latest PowerShell version you can if you want to have maximum performances.
Pingback: Add custom type to a PowerShell Custom Object - It For DummiesIt For Dummies
Pingback: Add custom method to custom object - It For DummiesIt For Dummies
Best tutorial ! 😉