Categories

Scripting Games–making work

I saw this in one of the submissions:

$Properties = @{}
$Properties['Computer'] = $SystemInfo.__SERVER
$Properties['OperatingSystem'] = "$($OSInfo.Caption) - $($OSInfo.CSDVersion)"
$Properties['PhysicalMemory'] = $SystemInfo.TotalPhysicalMemory  

My immediate thought was the entrant likes making work for themselves. The hash table can be created in a much simpler manner

$Properties = @{
Computer = $SystemInfo.__SERVER
OperatingSystem = "$($OSInfo.Caption) - $($OSInfo.CSDVersion)"
PhysicalMemory = $SystemInfo.TotalPhysicalMemory
}

Same result. Less typing and easiert o read when you come back to the script in 6 months time

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>