How to get the type of the HDD in PowerCLI

I would like to determine each VM HDD type. Is it thin or thick? I realized that this question is not a trivial.

Here are the commands, which gather the type of the disc.


$vm = Get-VM -name testsrv

$thin = (((($vm |get-view).config).Hardware).Device | where {$_.GetType().Name -eq "VirtualDisk"}).Backing.ThinProvisioned
if ( $thin )
{
Write-Host "    Disk provisioning type: Thin"
}
Else
{
Write-Host "    Disk provisioning type: Thick"
}

That’s all!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s