VMware Cloud Community
bklynjae
Contributor
Contributor

Storage Script

Hi All,

Ive been looking for a script for awhile time today and can't seem to find the one I need.

Need the script to List out all the Guests, their disks, and if they are independent or not.

Seems we ran into a fiasco and will need to make some major changes, uugh....

Thank you for your help..!!

0 Kudos
3 Replies
FMON
Enthusiast
Enthusiast

Try this:

$results = @()

foreach ($vm in Get-VM)

{

  foreach ($vmHardDisk in $vm | Get-HardDisk)

  {

  $out = "" | select Guest,DiskName,DiskFilename,DiskPersistence

  $out.Guest = $vm.Name

  $out.Diskname = $vmHardDisk.Name

  $out.DiskFilename = $vmHardDisk.Filename

  $out.DiskPersistence = $vmHardDisk.Persistence

  $results += $out

  }

}

$results | ft -AutoSize

0 Kudos
Gsanty
Contributor
Contributor

Can you help to get the NAA id of datastore where the vm,rdm disk resides with Capacity,Freespace in GB and percentage
0 Kudos
Gsanty
Contributor
Contributor

Can you help to get the NAA id of datastore where the vm,rdm disk resides with Capacity,Freespace in GB and percentage with above script
0 Kudos