How To Quickly Free Up Disk Space on a Terminal Server

If you’ve found this article, then you are experiencing the same issue on your terminal server as I have. When you have a terminal server with a lot of users, the downloads folder and recycle bin quickly fill up with unneeded documents as users work throughout the day. Here are a couple quick commands you can run to quickly free up space on your terminal server. 

Empty the Recycle Bins for All Users

Log onto your HyperV server and go to the settings of your VM, then click on Integration Service. Uncheck Time synchronization.

  1. Launch elevated Prompt. To do this, type CMD in the Start menu search box, right click on the Common Prompt and then click Run as administrator.
  2. Type the following command:

    rd /s c:\$Recycle.Bin

    (In the above command, ā€œcā€ is your Windows drive)

    Press the Enter key.

  3. Press Y key to confirm and empty Recycle Bin.
  4. Type Exit and press the Enter key again to close the Prompt.

Powershell Script to Delete Download Folder Contents for All Users

  1. Open Powershell with elevated permissions.
  2. Run the following command to delete the contents of ALL users downloads folder:

    All Users:
    Get-ChildItem C:\Users\*\Downloads\* | Remove-Item -recurse -force

    Single User (Replace Administrator with your desired Username):
    Get-ChildItem C:\Users\Administrator\Downloads\* | Remove-Item -recurse -force 


Powershell Script to Delete All Users Temp Files

Get-ChildItem -Path ‘C:\Users’ | foreach { Get-ChildItem -Path “$($_.FullName)\AppData\Local\Temp” -ErrorAction Ignore | Remove-Item -recurse -force }


Leave a Reply

Your email address will not be published. Required fields are marked *

Leave a Reply

Your email address will not be published. Required fields are marked *