bshwjt
1
$computername = Get-Content C:\scripts\comps.txt
foreach ($computer in $computername){
Get-WmiObject Win32_LogicalDisk -filter “DriveType=3” -computer $computer |
Select SystemName,DeviceID,VolumeName,@{Name=“Size(GB)”;
Expression={“{0:N1}” -f($.size/1gb)}},@{Name=“FreeSpace(GB)”;
Expression={“{0:N1}” -f($.freespace/1gb)}},@{Name=“LOW SPACE”;
Expression={“{0:N1}” -f($.freespace / $.size -lt .2)}} }
How do I get the report like below
Srv1 c: d: E : F :
Srv c: d: E : F :
dweda
2
Have you tried format-table?
I can not test it properly because I only have one disk.
foreach ($computer in $computername){
Get-WmiObject Win32_LogicalDisk -filter "DriveType=3" -computer $computer |
Select SystemName,DeviceID,VolumeName,
@{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},
@{Name="FreeSpace(GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}},
@{Name="LOW SPACE";Expression={"{0:N1}" -f($_.freespace / $_.size -lt .2)}}|Format-Table
}