# encoding: ascii
# api: powershell
# title: Get-Sandisks
# description: This is a simple script to get the number of physical drive, their type and Storage on remoter computers
# version: 0.1
# type: function
# author: Ravig
# license: CC0
# function: get-sandisks
# x-poshcode-id: 4871
# x-archived: 2014-02-09T10:53:11
# x-published: 2014-02-03T15:45:00
#
# Note: you must pass input file name and output file name
#
Function get-sandisks ([string]$InputFilename,[string]$OutputFilename)
{
$strComputer = gc $InputFilename
$MyObj = @()
foreach ($server in $strComputer) {
$colItems = get-wmiobject -class "Win32_DiskDrive" -namespace "root\CIMV2" -computername $server
foreach ($objItem in $colItems) { 
$Rep = "" | select "Server Name", "Disk", "Disk Space", "Type"
      $Rep."Disk" = $objItem.DeviceID 
      $Rep."Type" = $objItem.Model 
      $Rep."Disk Space" = ([Math]::Round($objItem.Size/1gb, 2)) 
      $Rep."Server Name" = $objItem.SystemName 
      $MyObj += $Rep
      #$MyObj
      $rep = $null}
      }
 $MyObj | sort | Export-Csv -Path $OutputFilename -NoTypeInformation
}
