Power shell script to check dedup status

Reading Time: 2 mins

Deduplication and compression: 

How to check if vSan cluster has dedup enabled, though there are many ways to check it, I would show two ways here:

From vCenter GUI:

Login to vCenter using web client or HTML client , navigate to cluster > Manage > settings > Virtual San > General

Deduplication and Compression status shows the status as enabled as shown in below screenshot:


This option would be simple and easy if there is only 1 or 2 vSan enabled clusters in vCenter. what if there are more? I would suggest to use below script that gives a clear output about the dedup status and disk group type.

Using simple power shell script:

Import-Module vmware.vimautomation.core
Connect-VIServer <vc name> -User <user name> -Password <password>
$clusternames=(Get-Cluster | Sort-Object Name).Name
foreach($clustername in $clusternames)
$dedupfetch=((Get-Cluster $clustername | Get-VsanClusterConfiguration).Cluster.customFields | ?{$_.Key -match "com.vmware.vsan.clusterstate"}).value
Get-Cluster $clustername | Get-VsanDiskGroup | Select-Object @{N="Cluster";E={"$clustername"}},DiskGroupType,@{N="DedupEnabled";E={"$dedupenablestatus"}} | Sort-Object Name -Unique | Format-Table -AutoSize


Output will be as:

 Cluster          DiskGroupType       DedupEnabled
             -------              -------------      ------------
<Cluster Name>   AllFlash                true

Leave a Reply