Automate your mundane
IT Tasks using our pre-made,
ready-to-run scripts.
Slider

Disk Drive Cleanup using PowerShell

Many users are facing the issue of reduced storage space in their C:\ and it is hampering system performance and speed. This PowerShell script will help you to deleted unnecessary/ unwanted files and folders from the system

Syntax

Function Start-Cleanup {
<#
.SYNOPSIS
Automate cleaning up a C:\ drive with low disk space

.DESCRIPTION
Cleans the C: drive’s Window Temperary files, Windows SoftwareDistribution folder,
the local users Temperary folder, IIS logs(if applicable) and empties the recycling bin.
All deleted files will go into a log transcript in $env:TEMP. By default this
script leaves files that are newer than 7 days old however this variable can be edited.

.EXAMPLE
PS C:\> .\Start-Cleanup.ps1

Download Full Script

Share Script:

Purpose:This script will help your free up space in your C-drive. It will delete Windows temp files, Software Distribution folder, users’ temp folder, IIS logs and empty the recycle bin folder. Logs will be saved to the path defined in the script
Modification:-
Type:PowerShell Script (ps1) 
Compatibility:Windows
Tags:Temporary files, Software Distribution folder, IIS logs (if applicable), Recycle Bin
Reference link: