Query free and used hard disk space locally or remotely using PowerShell

Today we would like to show you how you can use two relatively simple PowerShell commands to determine the free and used storage space of your hard drives. You can query your own local Windows system as well as remote systems. This is sometimes very useful to quickly get an overview of the current space requirements of Windows servers and then react if necessary in time.

Query storage space with Get-PSDrive

Microsoft provides the necessary command with the “Get-PSDrive” command. To get an overview of the local hard disks, just call ” Get-PSDrive ” in a PowerShell console. However, the output is quite confusing, so we recommend you, only the Part i output tion names, where free space is greater than zero. The command is then as follows.

Get-PSDrive | Where {$ _. Free -gt 0}

Below we have shown you this as an example.

Get-PSDrive

In this example, the partitions C: and E: are output and you can see immediately how much storage space is occupied on the data carriers and is still free.

Query occupied and free space remotely

The same query also works remotely , which means that you can also display this drive information from other Windows systems. It is important, however, that you run a PowerShell console as “another user” who has the appropriate rights so that he can also query this information remotely.

The PowerShell command is then as follows:

Invoke-Command -ComputerName COMPUTERNAME {Get-PSDrive | Where {$ _. Free -gt 0}}

We have also shown this to you here.

https://www.windows-faq.de/wp-content/uploads/2018/10/Invoke-Command-Get-PSDrive.png

In this case, the 4 partitions of the remote system including the free and used storage space are output.

In the following you will find more interesting information on the subject of “storage space” .


Show memory usage in Windows 10 and free up space – Windows.old delete folders and free up space – Free up
space in Windows 10 Fall Creators Update Version 1709
– Free up used space in Windows 10 Feature Updates (Creators Update)
– Deactivate the hibernation file hiberfil.sys and free up space
– delete system restore points and free up space
– disable clearing the cache cache on Windows 10

administrator