Pages: [1]
Print
Author Topic: listing all paths on each host from multiple vCenter servers  (Read 315 times)
esarakaitis
Administrator
Full Member
*****
Posts: 241


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: August 02, 2009, 02:31:12 AM »

Code:
$viServers = @()
#$viServers += Connect-ViServer "vctest01" -wa 0
$viServers += Connect-ViServer "vcprod02"-wa 0
$viServers += Connect-ViServer "vcentsy01"-wa 0
$viServers += Connect-ViServer "vcentsy02"-wa 0
$report = @()
Get-VMHost | %{
  $EsxName = $_.Name
  $ds = ($_ | Get-View).Datastore | %{get-view -Id $_} | where {$_.Summary.Type -eq "VMFS"}
  $luns = $_ | Get-ScsiLun
  $luns | %{
    $lun = $_.CanonicalName
    $nrPath = ($_ | Get-ScsiLunPath | Measure-Object).Count
$dsName = ($ds | where {$_.Info.Vmfs.Extent[0].DiskName -eq $lun}).Info.Name
$row = "" | Select EsxName, dsName, lun, nrPath
$row.ESXname = $EsxName
$row.dsName = $dsName
$row.lun = $lun
$row.nrPath = $nrPath
$report += $row
  }

$report | Export-Csv "C:\1.csv" -NoTypeInformation
Logged
Pages: [1]
Print
Jump to: