Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 49146

Need help fine tuning the storage path status script

$
0
0

Can somone please help with fine tuning the script to get the below details?

Output should have the pathstatus of all the LUNs (including RDMs, extent & not allocated LUNs) with below columns

 

"Date","ESXi_hostname","Name", "PathState"

 

Column "Name" should contain the data shown below (highlighted in yellow)

LUN.PNG

Column "PathState" - can be "Active/Standy/dead"

 

I got the below script from somewhere in the internet which used to work fine when running vCenter 6.0. Now that we have upgraded to 6.5, the script isn't provinding the Column "name" correctly.

 

For example, the Column "Name" instead of giving out as below: (please see attached - need the field Name circled in RED)

"vmhba1:C0:T1:L1,fc.200000107b1da97c:100000109a1da97c-fc.524a437f706ae713:524a437f706ae713-naa.624a8350b3e643afaf40452201171121"

 

it just give me this

"vmhba1:C0:T1:L1"

 

Please help me in correcting the script

 

i'm using PowerCLI 11

powercli.png

 

Script:

 

$hostList = 'D:\Scripts\HBA\PathStatus\ESXiHostList.txt'

$outputfile = 'D:\Scripts\HBA\PathStatus\Output\PathStatus.csv'

$vmhosts = Get-Content -Path $hostList

$allhostinfo = @()

$date = Get-Date -format "dd-MMM-yyyy HH:mm:ss"

foreach($vmhost in $vmhosts){

$hostinfo = ((Get-View(Get-VMHost $vmhost)).config.storagedevice.multipathinfo.Lun).Path | Select @{N="Date";E={$date}}, @{N="VMHost";E={$vmhost}}, Name, PathState, State

$allhostinfo += $hostinfo

}

$allhostinfo | Export-Csv $outputfile -noTypeInformation


Viewing all articles
Browse latest Browse all 49146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>