markdjones82
Expert
Expert

Just put them in foreach loops, sorry for the bad formatting, you may have to fix the formatting

$list = Get-Datacenter "test" % {  $datacenter=$_

   $_ | Get-Cluster "testcluster" | %{  $cluster = $_

     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://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
Reply
0 Kudos