Listing the drive letters, size and free space using PowerShell

Share this:

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.

Solution


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

 

image

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

Updates on Hyper-V Server? How to see what had bee... When do you need to see what updates had been installed on your Hyper-V server, you can use this PowerShell cmdlet to list all the updates. Get-WmiOb...
Checking if a mailbox is valid using Exchange Mana... In some scenarios we need to check if a mailbox database is valid on Exchange Server, this kind of validation is useful when migrating/transitioning m...
Automating the process to join a server to a domai... In this Tutorial we are going to optimize a simple task that in larger environments may take some time from the service desk/operations team which is ...
Script: Exchange Server 2016 Deployment (EXDeploy.... Hello folks, We created an automation script to deploy Exchange Server 2016 in a consistent way, and the script was published on our ITPROCentral a...