$CustomObject = @()
$obj = New-Object pscustomobject
$obj | Add-Member -property NoteProperty -name somename -value somevalue
$CustomObject += $obj
create a custom object in Powershell v2:
$CustomObject = @()
$obj = New-Object pscustomobject -Properties @{propertyname1= value1; propertyname2=value2}
$CustomObject += $obj
create a custom object in Powershell v2 (variation of method above):
$CustomObject = @()
$hash = @{
propertyname1 = value1
propertyname2 = value2
propertyname3 = value3
}
$obj = New-Object pscustomobject -Properties $hash
$CustomObject += $obj
No comments:
Post a Comment