18 March 2014

Custom object - the easy way

the hard way:

$customObject = New-Object PSObject
$customObject | Add-Member NoteProperty Name "Marius"
$customObject | Add-Member NoteProperty Age "33"
$customObject | Add-Member NoteProperty Country "Romania"



the easy way:

$customObject = " " | Select-Object Name, Age, Country
$customObject.Name = "Marius"
$customObject.Age = "33"
$customObject.Country = "Romania"

No comments:

Post a Comment