Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178257

Powercli script to match drive letter and SCSI Id correctly

$
0
0

Hi,

 

I am trying to write a powercli script that will give me hard disk information for my VMs; however, I am running into a problem when I try to match drive letters to the SCSI Id. When the SCSI controller is 0, the drive letters are matched correctly; however, when it is higher than 0, it will swap the drive letters.

Below is an example of the disk drives for a particular VM and corresponding SCSI Ids.

 

Drive Letter                   SCSI Id

       C:                             0:0

        I:                              0:1

       P:                             0:2

       Z:                              0:4

       J:                              1:0

       K:                             2:0

       T:                              3:0

 

My script gives me the correct output EXCEPT for the drives that have a SCSI controller higher than 0. For example:

 

Output.JPG

 

SCSI 1:0 should be drive letter J: instead of T:

SCSI 2:0 should be drive letter K: instead of J:

SCSI 3:0 should be drive letter T: instead of K:

 

In this example I am using the Get-WmiObject cmdlet, so the disk information matches the drive letter. I also tried doing it without using the Get-WmiObject cmdlet and the disk information matches the SCSI_Id; however, I can't get it so everything matches including Drive letter and SCSI Id.

 

Any ideas on how to do this? Any suggestions will be appreciated!

 

Thanks!


Viewing all articles
Browse latest Browse all 178257

Trending Articles



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