Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

You mean like this

$dcName = "MyDatacenter"

$list = Get-Datacenter -Name $dcName | %

  $datacenter=$_

  Get-VMhost -Location $datacenter | Get-VMHostHBA -Type FibreChannel | where {$_.Status -eq "online"} |

  Select @{N="Datacenter";E={$datacenter}},

      @{N="VMHost";E={$_.VMHost.Name}},

      Device,Status,

      @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}}

}

#Output CSV to current directory.

$list | export-csv -NoTypeInformation C:\output.csv


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos