Get disk informations on a remote computer with PowerShell


You can retrieve some disk information with a simple WMI call:

Get-WmiObject -Class Win32_LogicalDisk

This line retrieve all type of disks mounted on the destination host such as local disk, network drive, CD… You can also add a filter to that query, to get only local disk, on a specified remote computer like that :

Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType='3'" -ComputerName SOFSR2Node1


As you can read, the Size and FreeSpace are not really readable, you’ll need to use a dictionary like that :

Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType='3'" -ComputerName SOFSR2Node1 | Select-Object DeviceID,VolumeName,@{Label="FreeSpace(GB)";Expression={$_.FreeSpace/1GB -as [int]}},@{Label="Size(GB)";Expression={$_.Size/1GB -as [int]}}


That’s a nice output, and it’s pipe able like that :


This is a quick example of what can be done with that WMI class, but a lot more properties/methods are available :

Get-WmiObject -Class Win32_LogicalDisk | Get-Member

You can use that web page as a full and documented help, and this one for the Get-WmiObject help.



Leave a Reply