Adding output from loop to hash table powershell -
i have following code, #pull number of physical drives $phy = $datafile.getenumerator()|where-object {$_.name -like "*physical*"} [array]$phydisks = ($phy.name | sort-object ) #for each of these drives work work out physical make of disk $drives= foreach($_ in $phydisks){ $cylinders = $datafile["$_"]["cylinders"] $head = $datafile["$_"]["trackspercylinder"] $sectors = $datafile["$_"]["sectorspertrack"] $bytespersector = $datafile["$_"]["bytespersector"] #convert output gigabites , round the next decimal place $physicaldrivegb = ((([int]$cylinders * [int]$head * [int]$sectors * [int]$bytespersector) / 1024) / 1024) /1024 $physicaldrivesize = [math]::round($physicaldrivegb,1) } $vmwarefile = @{servername=$servername;memory = $servermemorymb;number_of_processors = $processorcount;'number_of_cores/processor' = $processorcorecount;number_of_disks = $numberofdisks} ...