AlbertWT
Virtuoso
Virtuoso

Powershell to match current Guest OS partition with the respective RDM partition VMDK name

Hello Everyone,

is it possibleto list which VMDK that each RDM partition attached to a VM ?

I tried using modified script below:

get-vm ExcMbx01-vm | sort-object Name | get-harddisk | Select @{N="VM name";E={$_.Parent.Name}},@{N="Capacity(KB)";E={[math]::truncate($_.CapacityKB / 1KB)}},Filename | ft -AutoSize

Because it is still too hard for me to match it with the Windows Partition name because as can be seen from the result of the bove script:

VM name     Capacity(KB) Filename                                                  
-------     ------------ --------                                                  
ExcMbx01-VM        65536 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM.vmdk 
ExcMbx01-VM        61440 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_1.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_2.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_10.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_11.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_3.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_4.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_5.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_6.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_7.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_8.vmdk
ExcMbx01-VM       133120 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_9.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_12.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_20.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_21.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_13.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_14.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_15.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_16.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_17.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_18.vmdk
ExcMbx01-VM        30720 [VMFS_FPE_01_NOT_REPLICATED] ExcMbx01-VM/ExcMbx01-VM_19.vmdk

my Exchange mailbox Server VM which uses RDM disks on my EMC SAN, while this is the script result that I have to list the Guest OS VM information:

ExcMbx01 C: - disk size - * (64 GB), used space (40.25 GB), free space (23.75 GB), percentage free space = 37.11 %
ExcMbx01 E: - disk size - SG1 Data (130 GB), used space (82.33 GB), free space (47.67 GB), percentage free space = 36.67 %
ExcMbx01 F: - disk size - SG2 Data (130 GB), used space (73.84 GB), free space (56.16 GB), percentage free space = 43.2 %
ExcMbx01 G: - disk size - SG3 Data (130 GB), used space (74.66 GB), free space (55.34 GB), percentage free space = 42.57 %
ExcMbx01 H: - disk size - SG4 Data (130 GB), used space (91.68 GB), free space (38.32 GB), percentage free space = 29.48 %
ExcMbx01 I: - disk size - SG5 Data (130 GB), used space (69.06 GB), free space (60.94 GB), percentage free space = 46.88 %
ExcMbx01 J: - disk size - SG6 Data (130 GB), used space (74.59 GB), free space (55.41 GB), percentage free space = 42.62 %
ExcMbx01 K: - disk size - SG7 Data (130 GB), used space (81.04 GB), free space (48.96 GB), percentage free space = 37.66 %
ExcMbx01 L: - disk size - SG8 Data (130 GB), used space (62.35 GB), free space (67.65 GB), percentage free space = 52.04 %
ExcMbx01 M: - disk size - SG9 Data (130 GB), used space (86.28 GB), free space (43.72 GB), percentage free space = 33.63 %
ExcMbx01 N: - disk size - SG10 Data (130 GB), used space (66.76 GB), free space (63.24 GB), percentage free space = 48.65 %
ExcMbx01 O: - disk size - Old SG10 Logs (30 GB), used space (0.120000000000001 GB), free space (29.88 GB), percentage free space = 99.61 %
ExcMbx01 P: - disk size - SG1 Logs (30 GB), used space (1.69 GB), free space (28.31 GB), percentage free space = 94.36 %
ExcMbx01 Q: - disk size - SG2 Logs (30 GB), used space (1.15 GB), free space (28.85 GB), percentage free space = 96.18 %
ExcMbx01 R: - disk size - SG3 Logs (30 GB), used space (0.989999999999998 GB), free space (29.01 GB), percentage free space = 96.69 %
ExcMbx01 S: - disk size - SG4 Logs (30 GB), used space (1.07 GB), free space (28.93 GB), percentage free space = 96.42 %
ExcMbx01 T: - disk size - SG5 Logs (30 GB), used space (0.98 GB), free space (29.02 GB), percentage free space = 96.72 %
ExcMbx01 U: - disk size - SG6 Logs (30 GB), used space (1.88 GB), free space (28.12 GB), percentage free space = 93.75 %
ExcMbx01 V: - disk size - SG7 Logs (30 GB), used space (1 GB), free space (29 GB), percentage free space = 96.66 %
ExcMbx01 W: - disk size - SG8 Logs (30 GB), used space (0.870000000000001 GB), free space (29.13 GB), percentage free space = 97.09 %
ExcMbx01 X: - disk size - SG9 Logs (30 GB), used space (1.4 GB), free space (28.6 GB), percentage free space = 95.34 %
ExcMbx01 Y: - disk size - SG10 Logs (60 GB), used space (0.920000000000002 GB), free space (59.08 GB), percentage free space = 98.47 %

any suggestion and idea would be greatly appreciated.

Thanks

/* Any kind of comment or input would be greatly appreciated */
0 Kudos
1 Reply
LucD
Leadership
Leadership

Have a look at Arnim's script in Miscellaneous script - Get-VMDiskMapping

And there's an even better version in the book.


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

0 Kudos