Here you go..
$esxhost = get-vmhost <vmHostName>
$esxhostview = $esxhost | Get-View
$storage = get-view $esxhostview.ConfigManager.StorageSystem
#Get LUN
$storage.StorageDeviceInfo.MultipathInfo.Lun
#Get HBA Info
$storage.StorageDeviceInfo.HostBusAdapter
first of all ,thanks
when i do $storage = get-view $esxhostview.ConfigManager.StorageSystem
i get "the argument is null or empty"
and how after this commands i get the input as output?
i didn't se any echo there
here is the out put i get when running it
C:\> powershell C:\Vmware\scripts\VMDK.ps1
New-Object : Cannot find type http://VMware.Vim.FileQueryFlags: make sure the assemb
ly containing this type is loaded.
At C:\Vmware\scripts\VMDK.ps1:4 char:30
+ $fileQueryFlags = New-Object <<<< VMware.Vim.FileQueryFlags
Property 'FileSize' cannot be found on this object; make sure it exists and is
settable.
At C:\Vmware\scripts\VMDK.ps1:5 char:18
+ $fileQueryFlags.F <<<< ileSize = $true
Property 'FileType' cannot be found on this object; make sure it exists and is
settable.
At C:\Vmware\scripts\VMDK.ps1:6 char:18
+ $fileQueryFlags.F <<<< ileType = $true
Property 'Modification' cannot be found on this object; make sure it exists and
is settable.
At C:\Vmware\scripts\VMDK.ps1:7 char:18
+ $fileQueryFlags.M <<<< odification = $true
New-Object : Cannot find type http://VMware.Vim.HostDatastoreBrowserSearchSpec: make
sure the assembly containing this type is loaded.
At C:\Vmware\scripts\VMDK.ps1:9 char:26
+ $searchSpec = New-Object <<<< VMware.Vim.HostDatastoreBrowserSearchSpec
Property 'details' cannot be found on this object; make sure it exists and is s
ettable.
At C:\Vmware\scripts\VMDK.ps1:10 char:14
+ $searchSpec.d <<<< etails = $fileQueryFlags
Property 'sortFoldersFirst' cannot be found on this object; make sure it exists
and is settable.
At C:\Vmware\scripts\VMDK.ps1:11 char:14
+ $searchSpec.s <<<< ortFoldersFirst = $true
Property 'matchPattern' cannot be found on this object; make sure it exists and
is settable.
At C:\Vmware\scripts\VMDK.ps1:12 char:14
+ $searchSpec.m <<<< atchPattern = "*.vmdk"
The term 'Get-Datastore' is not recognized as a cmdlet, function, operable prog
ram, or script file. Verify the term and try again.
At C:\Vmware\scripts\VMDK.ps1:14 char:15
Shaztal,
you need to replace the <vmHostName> with an ESX host name.
This script is not set up to connect to a Virtual Centre - it will have to be updated for this to work.
thanks , but i get the LUNs i want to know ieach vmhba to wich VM is connected.
cause i want to see al Raw device that are connete to the vm's with the VMHBA ID per Raw device with vm name