Saturday, 15 June 2013

Creating an array of objects in an object - Powershell -



Creating an array of objects in an object - Powershell -

i wish create array of events in calendar. both event , calendar objects. couldn't find documentation creation of simple array in object.

how -

$cal = new-object -type psobject -prop @{ year = 2013 events = @() } $event = new-object -type psobject -prop @{ date = [datetime] "2013-02-14" name = "valentines day" } $cal.events += $event

if have predefined calendar objects doesn't have property store events can utilize add-member attach new property , store array in there.

arrays object powershell

No comments:

Post a Comment