Luc has this great script to create a report of disks being used, in my case I need to map duplicate RDMs mapped to virtual machines across hosts, and I'm having issues getting it to run. My hosts, virtual machines, clusters all have "-" in them.
Anybody have experience with getting this to work? Your help is greatly appreciated!
http://www.lucd.info/2010/04/09/lun-report-datastores-rdms-and-node-visibility/
I have tried to add the line
$LunInfoDef += (“`n`tpublic string ” + ($_.Name.Split(“.”)[0].Replace('-','')) + ";")
And attempted to modify all lines with "-".
Example:
Hostname: okc-clu-esx01
VM: okc-clu-vm01
Cluster: okc-cluster1
I'm getting these errors, plus the others mentioned in the post referenced.
Cannot index into a null array.
At C:\users\nulluser\desktop\LUN.ps1:40 char:36
+ $scsiTab[$key] = $scsiTab[$key][ <<<< 0], $dsName, $scsiTab[$key][2]
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Yes, that is a known problem.
Unfortunately the sript uses the hyphen as a seperator in the key. and the hyphen is also a valid character for VM and Hostnames in vSphere.
You can replace the hyphen in 5 lines with another character to solve the problem.
See also one of my earlier replies on that post.
In any case, in the attached script, the hyphen is replaced by a hash character ('#').
Try that one.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Luc,
I ran the script you sent and I'm still getting the same error. It keeps failing on 40 char:36.
Cannot index into a null array.
At C:\users\desktop\LUN.ps1:40 char:36
+ $scsiTab[$key] = $scsiTab[$key][ <<<< 0], $dsName, $scsiTab[$key][2]
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
PowerCLI Version
----------------
VMware vSphere PowerCLI 4.1 U1 build 332441
---------------
Snapin Versions
---------------
VMWare vSphere PowerCLI 4.1 U1 build 332441
Strange, I'll drop you an email to ask for some details.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference