Feb 282014
 

This One Line of code will list the count of VMs on each datastore in the Datastore Cluster
Just edit the datastore cluster name below:

foreach($a in (get-datastorecluster MyDataStoreCluster | get-datastore)){write-host $a ($a | get-vm).count}

List will look like this:

Datastore-1 12
Datastore-2 10
Datastore-3 9
Datastore-4 1
Datastore-5 42

Feb 262014
 

This will check your ESXi host and tell you which LUNs support VAAI primitives.

 
$hostname = “myhost.pcli.me”

$report2 = @()
$Datastorelist = get-vmhost $hostname | Get-Datastore
foreach ($ds in $datastorelist) {
$reportrow = “” | Select DatastoreName,CName
$reportrow.DatastoreName = $ds.Name
$reportrow.CName = $ds.extensiondata.info.vmfs.extent | %{$_.diskname}
$report2 += $reportrow
}
$temp = get-esxcli -vmhost $hostname | %{$_.storage.core.device.vaai.status.get()}
$report = @()
foreach($a in $temp){
$ReportRow = “” | Select-Object Hostname,LunName,Device,ATSStatus,CloneStatus,DeleteStatus,VAAIPluginName,ZeroStatus
$ReportRow.hostname = $hostname
$ReportRow.LunName = $report2 | where {$_.cname -eq $a.Device} | %{$_.datastorename}
$ReportRow.Device = $a.Device
$ReportRow.ATSStatus = $a.ATSStatus
$ReportRow.CloneStatus = $a.CloneStatus
$ReportRow.DeleteStatus = $a.DeleteStatus
$ReportRow.VAAIPluginName = $a.VAAIPluginName
$ReportRow.ZeroStatus = $a.ZeroStatus
$report += $reportrow
}
$reportĀ | Ft -a