Scripting

Iterating hash values to a log file

While working on my last script, I was trying to figure out the best way to write the values stored in a hash table for the purposes of splatting out to a log file.

Consider:

$parameters = @{}
$parameters.Add("Parameter1","Value1")$parameters.Add("Parameter2","Value2")$parameters.Add("Parameter3","Value3")

$parameters = @{}; $parameters.Add("Parameter1","Value1"); $parameters.Add("Parameter2","Value2"); $parameters.Add("Parameter3","Value3")

I was using a modified version of my logging function, which is basically a wrapper for Add-Content with parameters for log detail/types, colors, and output display.… [ Continue reading ]