Adv-CODE-R
Contributor
Contributor

vPartition details from vCenter for all the residing VM's

Hello LucD,

I was looking for some help with my code kindly help 🙂

I was trying to generate a report from vCenter for all the VM's residing within (for now windows). Wanted to seek some help with code, since I'm the beginner and would like to get some help from you..

Here is the block of code which I was trying to figure out, but I'm not sure if this will fetch the vPartition (details of partitions within VM's like c drive, d drive etc..) of all the VMs:

$ValeCMReport = Get-VM | Select-Object
@{N=’Name’;E={$_.name}},
@{N=”Disk”;E={$_.DiskType}},
@{N=”Disk Capacity (in GB)”;E={$_.CapacityGB}},
@{N=”Disk Utilized (in GB)”;E={[math]::round(($_.CapacityGB))}},
@{N="Disk Consumed(in GB)";E={($_.CapacityGB -$_.FreeSpace)}},
@{N="Disk Free (in GB)";E={[math]::round($_.FreeSpace/1GB, 0)}},
@{N="Disk Free (in %)";E={[math]::Format("$_.FreeSpace {0:P2}" -f ($_.FreeSpace / $_.Size))}}

I was trying to export vPartition with these filters: (attached image) 🙂

Requirement will be that I want to export the vPartition details of all the VM's from a vCenter, it will be great help. Thank you in advance, Sir.

Labels (1)
Tags (2)
0 Kudos
1 Reply
LucD
Leadership
Leadership

vSphere, and consequently PowerCLI, has no notion of the filesystems inside the Guest OS running on a VM.
There is no fool-proof method to map Guest OS filesystem info to vDisks.

There are a couple of options to query the Guest OS for filesystem info.

Use Invoke-VMScript to run code inside the Guest OS that queries the filesystem.

Or, provided your environment meets the requirements, use the Get-VMGuestDisk cmdlet.


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

0 Kudos