Reply to Message

View discussion in a popup

Replying to:
vin01
Expert
Expert

Hi Mark

Sorry for delay..I tried the given script as below but its not working..and also i need hostname in for esxi host in the out put can you please correct me on the script if any wrong and add host name string...

========================

$list = Get-Datacenter "HYD DC" % {  $datacenter= $_ $_ | Get-Cluster "SUN-UAT" |%{  $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 -Path SUN-UAT.csv -NoTypeInformation

==========================================

getting error:

errork.JPG

Regards Vineeth.K
Reply
0 Kudos