30th June 2020

VMware PowerShell – How to Detect Thick Disks

VMware PowerShell - How to Detect Thick DisksVMware PowerShell – How to Detect Thick Disks

I was helping out someone today who needed to identify how to detect thick disks.  They wanted to find out what disks on their VMware vSAN storage had been provisioned as ‘thick’.

They’d been working to a standard where everything should have been deployed as a ‘thin’ disk.  However, during an extended period of importing virtual machines they had discovered that many of the source VMs had been provisioned with a ‘thick’ disk policy.

The team where at the point where they where about to check each VM for the configuration when I suggested that I could write them a PowerShell script to detect thick disks in the estate.

How to detect thick disks – Script

The following assumes that you are connected to a virtual centre already.

$report = @()
foreach ($vm in Get-VM){
$view = Get-View $vm
if ($view.config.hardware.Device.Backing.ThinProvisioned -eq $false){
$row = '' | select Name, VMDKs, Thin
    $row.Name = $vm.Name
    $row.VMDKs = $view.config.hardware.Device.Backing.Filename | Out-String
    $row.Thin = $view.config.hardware.Device.Backing.ThinProvisioned | Out-String
$report += $row
$report | Sort Name | Export-Csv -Path "C:\Export\ThickDisks.csv"

There we have it, not particularly complicated but saved someone a very annoying manual job!

The script function could be changed to detect thin disks by changing line 4 to ‘-eq $true’

if ($view.config.hardware.Device.Backing.ThinProvisioned -eq $true){

Expected Output

The file being created is a *.csv that should contain three columns the Object Name, VMDK names and if it is Thin.

Name VMDKs Thin
Thick_Object [vsanDatastore] Thick_Object/Thick_Object.vmdk
[vsanDatastore] Thick_Object/Thick_Object_1.vmdk

Changing virtual disk to Thin or Thick provisioned

The full process for then changing the virtual disk can be found at the following KB article



Learning PowerShell or vSAN?

Check out these books!

Need a summer Read?