Powershell

Table of Contents

Object, Property and Hash tables

#Add Member property
$query = Get-WmiObject -Class win32_logicaldisk
$freespace = "{0:N2}" -f ($query.FreeSpace /1GB)
$computername = $env:COMPUTERNAME
$hash = @{"Freespace"=$freespace}
$object = New-Object -TypeName psobject -Property $hash
Add-Member -MemberType NoteProperty -Name computername -Value $computername -InputObject $object

Visit next page to learn about - Strings, Arrays and Regex