Thank you very much LucD. That worked perfectly :)
Original Message:
Sent: Jun 11, 2024 10:24 AM
From: LucD
Subject: How to get the below screenshot information using powercli
Check with this one
Targets =($esx.ExtensionData.Config.StorageDevice.ScsiTopology.Adapter.Target | Measure-Object).Count
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Jun 11, 2024 07:29 AM
From: ganapa2000
Subject: How to get the below screenshot information using powercli
Hi LucD,
Still I am getting the active path numbers not the targets, in my case, I see targets are 5 in GUI


Original Message:
Sent: Jun 11, 2024 05:31 AM
From: LucD
Subject: How to get the below screenshot information using powercli
Try like this
Get-Cluster -PipelineVariable cluster |Get-VMHost -PipelineVariable esx |ForEach-Object -Process { New-Object -TypeName PSObject -Property ([ordered]@{ Cluster = $cluster.Name VMHost = $esx.Name Adapters = $esx.ExtensionData.Config.StorageDevice.HostBusAdapter.Count Targets = ($esx.ExtensionData.Config.StorageDevice.MultipathInfo.Lun | Group-Object -Property Id).Count 'Attached Devices' = $esx.ExtensionData.Config.StorageDevice.ScsiLun.where{ $_.OperationalState -eq 'ok' }.Count, $esx.ExtensionData.Config.StorageDevice.ScsiLun.Count -join ' of ' 'Active Paths' = $esx.ExtensionData.Config.StorageDevice.MultipathInfo.Lun.Path.Where{ $_.PathState -eq 'active' }.Count Datastores = (Get-Datastore -RelatedObject $esx).Count })}
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Jun 11, 2024 02:46 AM
From: ganapa2000
Subject: How to get the below screenshot information using powercli
Hi LucD,
I am able to get the output but Targets are showing active path count. it should be target count as 4 or 5.

Original Message:
Sent: Jun 10, 2024 11:34 AM
From: LucD
Subject: How to get the below screenshot information using powercli
Try something like this
Get-Cluster -PipelineVariable cluster |Get-VMHost -PipelineVariable esx |ForEach-Object -Process { $hba = Get-VMHostHba -VMHost $esx $lun = Get-ScsiLun -VmHost $esx $path = Get-ScsiLunPath -ScsiLun $lun New-Object -TypeName PSObject -Property ([ordered]@{ Cluster = $cluster.Name VMHost = $esx.Name Adapters = $esx.ExtensionData.Config.StorageDevice.HostBusAdapter.Count Targets = $esx.ExtensionData.Config.StorageDevice.MultipathInfo.Lun.Path.Count 'Attached Devices' = $esx.ExtensionData.Config.StorageDevice.ScsiLun.where{$_.OperationalState -eq 'ok'}.Count, $esx.ExtensionData.Config.StorageDevice.ScsiLun.Count -join ' of ' 'Active Paths' = $esx.ExtensionData.Config.StorageDevice.MultipathInfo.Lun.Path.Where{$_.PathState -eq 'active'}.Count Datastores = (Get-Datastore -RelatedObject $esx).Count })}
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Jun 10, 2024 10:23 AM
From: ganapa2000
Subject: How to get the below screenshot information using powercli
How to get the below screenshot information using powercli
I would like to get the host and its path details
