PoshCode Archive  Artifact [369befe869]

Artifact 369befe8694e736ac1c42a5111cea89d2e0f391d9b8a48ef39bc1a561a803592:

  • File Get-Sandisks.ps1 — part of check-in [71a357d938] at 2018-06-10 13:47:14 on branch trunk — This is a simple script to get the number of physical drive, their type and Storage on remoter computers (user: Ravig size: 1125)

# 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
}