A few days ago powershell.com's blogger David Fargo put out a great little trick to change a hash table into a psobject (http://app.en25.com/e/es.aspx?s=1403&e=242&elq=82fe96d591f745bc820e8359018e3ffe). That was a great start, but really did not seem to usefull without a few more tweaks. Why? Because it was still just a single object from which you would get the same information. Example:
$hash.Firstname = "Tobias"
$object.Firstname = "Tobias"
Now, we can add this new object into an array and create useful mergers of data to create full tables.
CODE
$hash = @{}
$hash.Firstname = "Tobias"
$hash.Lastname = "Weltner"
$hash.Age = 99
$object = New-Object PSObject -Property $hash
$array += $object
$hash = @{}
$hash.Firstname = "Adrian"
$hash.Lastname = "Caliente"
$hash.Age = 47
$object = New-Object PSObject -Property $hash
$array += $object
$array)}
0 comments:
Post a Comment