Hi Luc,
if you can suggest how i can run orange line in background and not shown in console .as this can cause overwhelming display of vm partitions which is not desired .
all i want to display is green light .
also i found that freespacepercent is not the direct properties in most of the commands in datastore and disk partitions which i think should be incorporated in future release of powercli.
foreach($v in (get-vm -Location cluster1|?{$_.Guest.GuestFamily -eq 'windowsguest'}))
{
$vm=get-vm -name $v
#$vm.guest.Disks
#cls
$paths=$vm.guest.Disks
foreach($p in $paths)
{
$partition_freespace_percent=$p.freespacegb/$p.capacityGB*100
$partition_freespace_percent_round=[math]::Round($partition_freespace_percent)
#$partition_freespace_percent_round
$p|select @{N='vmname';E={$vm.name}},@{N='partition';E={$p.Path}},@{N='freespacepercent';E={$partition_freespace_percent_round}}
if($partition_freespace_percent_round -le 10)
{
write-host "check free space percentage on" $p.path "on" $vm.name -ForegroundColor red
}
}}