VMware Cloud Community
grgjn
Contributor
Contributor
Jump to solution

How can I use PowerCLI to get output of iSCSI software adapter advanced options.

Hello,

I am trying to generate output that would list all the Advanced Options settings of the iSCSI software adapter. Anyone able to provide me with the commands to do this?

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

$esxName = 'MyEsx'

$iHBA = Get-vmhost -Name $esxName | Get-VMHostHba -Type IScsi

$iHBA.ExtensionData.AdvancedOptions


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

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

$esxName = 'MyEsx'

$iHBA = Get-vmhost -Name $esxName | Get-VMHostHba -Type IScsi

$iHBA.ExtensionData.AdvancedOptions


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

Reply
0 Kudos
Globalresponse
Contributor
Contributor
Jump to solution

Works great. I modified it to grab all of my host.

Question: how do you get it to format into a table. I tried doing a |ft -autosize and it didn't work as expected. 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could do this through multiple calculated properties, but there is an easier way (and shorter) if you want to list all advanced options.
Seen the number of properties in the output, this will most probably not fit on your console screen (unless you set the width to a rather high number).
Best is to list this with Format-List or export the data to an external file.

Get-VMHostHba -Type IScsi |

ForEach-Object -Process {

   $obj = [ordered]@{

   VMHost = $_.VMHost.Name

   }

   $_.ExtensionData.AdvancedOptions.GetEnumerator() |

   ForEach-Object -Process {

   $obj.Add($_.Key, $_.Value)

   }

   New-Object PSObject -Property $obj

}


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

Reply
0 Kudos