Reply to Message

View discussion in a popup

Replying to:
markdjones82
Expert
Expert

I actually have a blog posting for this and I modified what I had for yours.


$list = Get-Datacenter "test" | Get-Cluster "testcluster" | Get-VMhost | Get-VMHostHBA -Type FibreChannel | where {$_.Status -eq "online"} | Select @{N="Datacenter";E={$datacenter}},@{N="Cluster";E={$cluster}},VMHost,Device,Status,@{N="WWN";E={("{0:X}"-f$_.PortWorldWideName).ToLower()}}


foreach ($item in $list){
  
$item.wwn = (&{for ($i=0;$i -lt $item.wwn.length;$i+=2
  { 
  
$item.wwn.substring($i,2
  }})
-join':'
}

#Output CSV to current directory.
$list | export-csv -NoTypeInformation C:\output.csv




http://nutzandbolts.wordpress.com | @markdjones82

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com