Disk Report

Tagged: 

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

  • Author
    Posts
  • #57178
    Profile photo of Biswajit
    Biswajit
    Participant

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

    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.