Disk Report


This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Daan Weda Daan Weda 7 months, 2 weeks ago.

  • Author
  • #57178
    Profile photo of Biswajit

    $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 :

  • #57281
    Profile photo of Daan Weda
    Daan Weda

    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

You must be logged in to reply to this topic.