- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Find virtual machine's datastore
Hi
Does someone know how to write a script to list the datastore namse that each disk reside on?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
See below 3 links
To list VM, cluster, hosts, folders, vmdk file path
Virtual Machine VMDK file report with PowerCLI | vNiklas Virtualization blog
PowerCLI List all VMDK disks and what datastore they are on | Virtual Me
Thanks,
Bayu
Author of VMware NSX Cookbook http://bit.ly/NSXCookbook
https://github.com/bayupw/PowerNSX-Scripts
https://nz.linkedin.com/in/bayupw | twitter @bayupw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi try this,
$vm = Get-vm <vmname>
$vhdds = $vm | get-harddisk
foreach($vhdd in $vhdds)
{
$hddlabel = $vhdd.extensionData.DeviceInfo.Label
$hddSize = $vhdd.CapacityGB;
$hddFilePath = $vhdd.FileName
}
this is same as in the links but simpler version, you can print or export the variables as you need.
for FilePath if you only need Datastore,
do
$hddFilePath = $hddFilePath.Split(" ")[0]
hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you add naa.id on this script? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You rather get RVtools export .It has all this info in nice excel file ![]()
You can get it from here RVTools - Home