# encoding: ascii # api: powershell # title: # 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 # license: CC0 # function: get-sandisks # x-poshcode-id: 4870 # x-archived: 2014-04-09T16:41:05 # # 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 }