VMware Cloud Community
malabelle
Enthusiast
Enthusiast
Jump to solution

Export windows Drive Letter and vmware Hard Disk number to csv

Hi,

is there a way to export to csv the windows drive letter (c:, d:, e:, etc) and vmware hard disk number ("Hard Disk 1", Hard Disk 2", etc) to a csv file?

vExpert '16, VCAP-DCA, VCAP-DCD
0 Kudos
1 Solution

Accepted Solutions
avlieshout
VMware Employee
VMware Employee
Jump to solution

Have a look at this document: http://communities.vmware.com/docs/DOC-12180

It's based on Hugo Peeters' Idea , but it uses the Invoke-VMScript cmdlet and hence doesn't require a working network connection between the VM and your PowerCLI station.

The export is sent to the Out-GridView cmdlet, but it can be easily redirected to a CSV file by replacing the line:

$DiskInfo | Out-GridView

with:

$DiskInfo | Export-Csv "C:\Script\VMDiskMapping.csv"

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The link between the drive letter, which lives inside the OS running in your guest, and the virtual disk(s) attached to your guest are not obvious.

Hugo made, some time agao, a great script that makes the link based on SCSI IDs.

See Hugo's Get VMware Disk Usage with Powershell post.

In our soon to be released PowerCLI book, my co-author Arnim made an even more advanced script to do this.

But you will have to wait till the book is published :smileycool:


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

0 Kudos
avlieshout
VMware Employee
VMware Employee
Jump to solution

Have a look at this document: http://communities.vmware.com/docs/DOC-12180

It's based on Hugo Peeters' Idea , but it uses the Invoke-VMScript cmdlet and hence doesn't require a working network connection between the VM and your PowerCLI station.

The export is sent to the Out-GridView cmdlet, but it can be easily redirected to a CSV file by replacing the line:

$DiskInfo | Out-GridView

with:

$DiskInfo | Export-Csv "C:\Script\VMDiskMapping.csv"

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos