- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again. Because of mistake of out network engeneers I need to get all devices, targets and paths VMHost looking at. Is there any script to do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try something like this
Get-VMHost -PipelineVariable esx | Get-ScsiLun -LunType disk -PipelineVariable lun | Get-ScsiLunPath |
Select @{N='ESX';E={$esx.Name}},
@{N='LUN';E={$lun.CanonicalName}},
LunPath,State
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Get-VMHost <vmhost> -PipelineVariable esx | Get-ScsiLun -LunType disk -PipelineVariable lun | Get-ScsiLunPath |
Select @{N='ESX';E={$esx.Name}}, @{N='LUN';E={$lun.CanonicalName}}, LunPath, State, @{n='WWN';e={
$wwn = Get-VMhost $esx | Get-VMHostHBA -Type FibreChannel | select @{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}} | select -ExpandProperty WWN
if ($_.LunPath -like "*vmhba1*"){
$wwn[0]
}else{
$wwn[1]
}
}
}
Works fine, thanks, LucD ![]()
How can I look deeper and get the full path information like esxcli storage core path list command?
UID: <adapter id>+<target id>+<LUN canonical name>
Runtime Name: <LDEV>
Device: <naa>
Adapter: vmhba0
Target: <target number>
LUN: <LUN id>
State: active
Transport: fc
Adapter Identifier: <adapter ID>
Target Identifier: <target ID>
Adapter Transport Details: WWNN: <why not?> WWPN: <...>
Target Transport Details: WWNN: <...> WWPN: <...>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The sample script I gave doesn't show all the properties that are available from Get-ScsiLun and Get-ScsiLunPath.
Which specific properties from $esxcli.storage.core.path.list() do you want to get in the output?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
*UPD
got it. $esxcli.storage.core is the key
Thanks for the help.
Btw, what's the tag for the script code to display normally?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On the code question, basically in the VMTN editor you can switch to HTML mode, and then it's a matter of copying code from your editor as HTML.
Most editors support that nowadays, if not there are add-ons as well.
I did a document on that see Some ways to enter PowerCLI code under the new forum SW
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference