Listing the drive letters, size and free space using PowerShell

Using PowerShell, the administrator is able to retrieve a lot of information from the operating system. In Today’s Tutorial, we are going the process to retrieve all volumes of any given server, and show the amount of disk and free space in GB.


The solution is simple, basically we need to create an expression to format the output in GBs. Using the following cmdlet we can have the desired solution.

Get-WmiObject win32_logicaldisk –ComputerName servername | ft DeviceID,VolumeName,@{Name=”Free Space (GB)”;Expression={[math]::round($_.FreeSpace / 1GB,0)}},@{Name=”Size in GB”;Expression={[math]::round($_.Size /1GB,0)}} –AutoSize