Io farei cosė:
Codice:
$disk = Get-WmiObject Win32_LogicalDisk -ComputerName remotecomputer -Filter "DeviceID='C:'" |
Select-Object Size,FreeSpace
$percentuale = $disk.Freespace / $disk.Size * 100
if ($percentuale -lt 10){
inviaMail()
}
Io comunque personalmente non userei script fatti in casa ma applicativi specificatamente sviluppati...