Home Windows 10 Windows 10 Tips: How to Get Disk Space of Remote Computer

Windows 10 Tips: How to Get Disk Space of Remote Computer

As technology is advancing day by day, our reliance on it is also increasing. We not only rely on a single but tend to bound ourselves with multiple devices. Now, this devices can be your Smartphones, Tablets, Laptops, PC’s for Home and Offices, etc.

Since our reliability has already increased, we tend to keep our office as well as private files on a cloud storage. This cloud storage offers a great deal since we do not have to save the files physically on the device we are using. Still, some of the tasks require the original files to be present on the device. But, we are not here to talk about it.

Moving towards our point of discussion, what if you are working on multiple devices but the device which is far from your reach has almost got its disk filled. Now, you want to check the disk space the device is using, how would you do it without actually sitting in front of it?

Let’s just say that one can check how many no. of partitions the remote computer is having, how much disk space is used and how much of the free disk is left. Yes, you read it right. It is possible to access the disk space information of a remotely located machine.

How to Get Disk Space of Remote Computer

Before we get started, first you should know that the process we are going to perform doesn’t work with every version of Windows.

Get Disk Space of Remote Computer

The only versions of Windows supported by this technique are Windows 10, Windows Server 2012, Windows Server 2012 R2, Windows Server 2008, Windows Server 2008 R2 and Windows 7.

Read Our Detailed guide Getting Started with Windows PowerShell

To get started, first download this PowerShell Script from here. Save it on your PC. Open the file you just downloaded using any IDE or Notepad as per your convinience. The file will look something like this:
<#
.Synopsis
Gets Disk Space of the given remote computer name
.DESCRIPTION
Get-RemoteComputerDisk cmdlet gets the used, free and total space with the drive name.
.EXAMPLE
Get-RemoteComputerDisk -RemoteComputerName "abc.contoso.com"
Drive UsedSpace(in GB) FreeSpace(in GB) TotalSpace(in GB)
C 75 52 127
D 28 372 400

.INPUTS
Inputs to this cmdlet (if any)
.OUTPUTS
Output from this cmdlet (if any)
.NOTES
General notes
.COMPONENT
The component this cmdlet belongs to
.ROLE
The role this cmdlet belongs to
.FUNCTIONALITY
The functionality that best describes this cmdlet
#>
function Get-RemoteComputerDisk
{

Param
(
$RemoteComputerName = "Enter the Address here"
)

Begin
{
$output="Drive `t UsedSpace(in GB) `t FreeSpace(in GB) `t TotalSpace(in GB) `n"
}
Process
{
$drives=Get-WmiObject Win32_LogicalDisk -ComputerName $RemoteComputerName

foreach ($drive in $drives){

$drivename=$drive.DeviceID
$freespace=[int]($drive.FreeSpace/1GB)
$totalspace=[int]($drive.Size/1GB)
$usedspace=$totalspace - $freespace
$output=$output+$drivename+"`t`t"+$usedspace+"`t`t`t`t`t`t"+$freespace+"`t`t`t`t`t`t"+$totalspace+"`n"
}
}
End
{
return $output
}
}

Now you need to enter the address of your remotely located machine in the position marked as Enter the Address here.

Save the file. Right click on the file and select the option Run with PowerShell. After some initial seconds, you will get the result on your PowerShell Window as:

Get Disk Space of Remote Computer

To know more about the above procedure, click here.