VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

SCSI ID shows blank for RDM disks of the VM

Hi,

From the below script, SCSI ID shows blank, For Example, it should shows as (1:1)

From,when, I execute the script, getting error, SCSI ID field shows blank

You cannot call a method on a null-valued expression.

At C:\VM_RDM_Info.ps1:23 char:29

+                 $ScsiId = &{$strControllerKey = $_.ControllerKey.ToString(); "{0 ...

+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.

At C:\VM_RDM_Info.ps1:23 char:78

+                 $ScsiId = &{$strControllerKey = $_.ControllerKey.ToString(); "{0 ...

+                                                                              ~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : NullArray

Please help.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

My mistake, the last part should also say $dev instead of $_.

I corrected it above, try again


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

That line should be

$row.ScsiId = &{$strControllerKey = $dev.ControllerKey.ToString(); "{0}`:{1}" -f $strControllerKey[$strControllerKey.Length - 1], $dev.Unitnumber}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Thanks for your reply,

I am getting output as 00:00 which is not correct for that disk. (correct SCSI ID is 1:0)

Am I missing something ?

Thanks

Madhu

0 Kudos
LucD
Leadership
Leadership
Jump to solution

My mistake, the last part should also say $dev instead of $_.

I corrected it above, try again


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos