Quick and Easy vSAN Capacity by Disk - DiskGroup - Host Report

This code sample will report the disk utilization of a vSAN Cluster by disk/diskgroup/host


Sign in to be able to add comments.

Comments 2


1613857083 4 years ago
I got this error with PowerCLI 10.1.0, Get-ExecutionPolicy outputs RemoteSigned:

PS C:\Program Files (x86)\VMware\Infrastructure\PowerCLI> .\Scripts\vsancapacity.ps1
Cluster: <clustername>
-<hostname>
--(0) Disk group (020000000058ce38ee2029b7014d4f30303136)
-- --Disk: naa.58ce38ee20540c11
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:48 char:7
+ Write-Host "-- -- --Capacity: " $Disk.CapacityGB.ToString("#.## ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

-- -- --Used GB:
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:56 char:7
+ Write-Host "-- -- --Used Percent:" $Disk.UsedPercent.ToString(" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


-- --Disk: naa.58ce38ee20540c05
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:48 char:7
+ Write-Host "-- -- --Capacity: " $Disk.CapacityGB.ToString("#.## ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

-- -- --Used GB:
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:56 char:7
+ Write-Host "-- -- --Used Percent:" $Disk.UsedPercent.ToString(" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


-- --Disk: naa.58ce38ee20540c09
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:48 char:7
+ Write-Host "-- -- --Capacity: " $Disk.CapacityGB.ToString("#.## ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

-- -- --Used GB:
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\vsancapacity.ps1:56 char:7
+ Write-Host "-- -- --Used Percent:" $Disk.UsedPercent.ToString(" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


Disk Group 0 Capacity (in GB):
Disk Group 0 Used (in GB):
-----------------------------------------------------
Host Capacity (in GB):
Host Used (in GB):

-----------------------------------------------------
1613857083 4 years ago
I've update PowerCLI vSphere (11.2.0) now it's working as designed.