1 2 Previous Next 15 Replies Latest reply on Sep 7, 2016 1:36 AM by Mike_Yazbeck

    Powercli script to match drive letter and SCSI Id correctly

    eblank Novice

      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!

        1 2 Previous Next