I would like to know if there is a way to add a If statement in the expression of a WMI-object | select ...
here is what I have :
Get-WmiObject -Class Win32_LogicalDisk -Filter DriveType=3 -ComputerName $ServersinFarm | Select @{Name='Server Name';Expression={$_.SystemName}} , DeviceID , @{Name="size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}}, @{Name="freespace(GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}}
and I want to add a column to the output If the freespace < 10gb that writes error
Any Ideas?