- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got the plan. LOTS OF HASH TABLES ![]()
Big thanks for help.
*UPD. Need more help, please.
So with this script
$adapterTab = @{}
$pathTab = @{}
$lunTab = @{}
$dsTab = @{}
foreach($ds in (Get-Datastore | where{$_.ExtensionData.Summary.MultipleHostAccess})){
$ds.ExtensionData.Info.Vmfs.Extent | %{
if($_.DiskName){
$dsTab.Add($_.DiskName,$ds.Name)
}
}
}
foreach ($esx in Get-VMHost){
$esx.ExtensionData.Config.StorageDevice.HostBusAdapter | %{
$adapterTab.Add($_.Key,$_.Device)
}
$esx.ExtensionData.Config.StorageDevice.MultipathInfo.Lun | %{
$pathTab.Add($_.Lun,$_.Path.Name)
}
$esx.ExtensionData.Config.StorageDevice.ScsiLun | %{
$lunTab.Add($_.Key,$_.CanonicalName)
}
foreach($adapter in $esx.ExtensionData.Config.StorageDevice.ScsiTopology.Adapter){
foreach($target in $adapter.Target){
foreach($lun in $target.Lun){
$lun | Select @{N='ESX';E={$esx.Name}},
@{N='Adapter';E={$adapterTab[$adapter.Adapter]}},
@{N='Canonical';E={$lunTab[$lun.ScsiLun]}},
@{N='Path';E={$pathTab[$lun.ScsiLun]}},
Lun,
@{N='Datastore';E={$dsTab[$lunTab[$lun.ScsiLun]]}}
}
}
}
}
I get information I need. It search every host, and write expanded paths. Am I going right way, or I'm breaking gravity? ![]()
And one more question. How can I add RDMs in hash table?
$RDMS = get-datacenter | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual"
$RDMS | %{$rdmTable.add($_.parent, $_.scsicanonicalname)}
isnt work, because I need pairs... It makes me mad ![]()