$BisDatastores = Get-Datacenter Primary* | Get-Datastore | where-object {$_.Name -notlike "*A9K_R*" -and $_.Name -notlike "*SYS*" -and $_.Name -notlike "*V5K*" -and $_.Name -notlike "*local*"} $BisVMs = $BisDatastores | Get-VM | where-object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } $BisGroup = $BisVMs | select Name,@{n='vVols';e={($_ | Get-HardDisk).count + 2}} | group-object vVols $MdnDatastores = Get-Datacenter Secondary* | Get-Datastore | where-object {$_.Name -notlike "*A9K_R*" -and $_.Name -notlike "*SYS*" -and $_.Name -notlike "*V5K*" -and $_.Name -notlike "*local*"} $MdnVMs = $MdnDatastores | Get-VM | where-object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } $MdnGroup = $MdnVMs | select Name,@{n='vVols';e={($_ | Get-HardDisk).count + 2}} | group-object vVols