Share via


Windows Troubleshooting: Low Disk Space issues

We have witnessed the issue of Low Disk Space on the Hard Drive of the Server and WorkStation. Discussed below few options to overcome such situations. This process can be followed post/pre using Disk Clean-Up Wizard.

 

Start the Windows PowerShell.

  1. Click on Start > search for CMD > Right click and select “Run As Administrator”.
  2. In the command window type PowerShell; CMD window will be converted to PowerShell.
  3. Execute all the commands mentioned in the PowerShell window.

Note

All the commands are executed for location/drive C:\, please change it to the location/drive you would like to work on according to your need.

Option-1

Execute below command in PowerShell window to get the list of top 10  biggest files consuming space on Hard Drive. Locate them using Windows Explorer and delete them if needed post analysis.

Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.Length -ne $null } | Sort-Object Length -Descending|  select  -First 10

Note

The number 10 (mentioned in above command) can be modified based on requirement. 

Option-2

There are chances where, there are multiple files with different sizes consuming space on the Drive. Execute the below command to locate all the files on the Hard Drive. This command would give the list of all files with their path, extension and size, sorted in descending order; they can be deleted if needed post analysis.

1. Get the report in PowerShell window.

Get-ChildItem -Path d:\ -Recurse | Where-Object {$_.length -ne $null } | select VersionInfo,Length | Sort-Object Length -Descending
  1. Export the report in CSV file.
Get-ChildItem -Path d:\ -Recurse | Where-Object {$_.length -ne $null } | select VersionInfo,Length | Sort-Object Length -Descending | Out-File D:\Vipin\PowerShell\FileSize_Report.csv

Note

Location of the file (D:\Vipin\PowerShell )should be modified accordingly before executing the command. Once the report is generated locate them using Windows Explorer and delete if needed post analysis

Option-3

Locate files based on their extension. Below command would give you the list of all the files along with their location and size.

 

1. Below example is to locate all the MP4 files.

Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.Name -like "*.mp4"}

2**. **Below Example is to locate ISO files.

Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.Name -like "*.iso"}

** **3. Send this report to the CSV file.

Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.Name -like "*.iso"} | Out-File D:\Vipin\PowerShell\FileType_Report.csv

Note

Location of the file (D:\Vipin\PowerShell )should be modified accordingly before executing the command. Once the report is generated locate them using Windows Explorer and delete if needed post analysis