PowerShell for Windows Admins

May 9 2013   1:43PM GMT

Scripting Games–making work

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 easier to read when you come back to the script in 6 months time

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: