You are using an ad blocker that is interfering with our web typography and internal javascript. Please whitelist our domain to live in a more beautiful world. No ads here, just really great software!

Disk Cleanup

Remove unnecessary files such as temporary, cached or deleted, memory dumps and unused user profiles from devices.

Description

  • “Interactive User Cleanup” includes content removal of user temporary folder and recycle bin.
  • “System Cleanup” includes cleanup of WinSxS folder, SCCM cache based on provided file age, and unused user profiles based on provided profile last use time.
  • “Remove Dump Files” removes dump files and BSOD errors based on the file date creation.

Script Disk Cleanup

  • Version 4.0.0.0 – Added support for a Chatbot to execute script without campaign
  • Version 3.0.1.0 – Recycle bin cleaning is done similarly for Windows 7 and 10
  • Version 3.0.0.0 – Fixed issue affecting deep cleanup. Added input parameter ‘RemoveFilesOlderThanDays’ and ‘MaximumDelayInSeconds’
  • Version 2.0.0.0 – Added campaign to notify about completion of cleanup. Code refactoring. Removed Windows 8.1 support
  • Version 1.0.0.0 – Initial release

Script Description

An assisted-help campaign is triggered to perform a light (recycle bin) or a deep (recycle bin and user temporary files) clean.
In order to run a silent execution, campaign can be skipped by providing an empty GUID as input DiskCleanupCampaignId. In such case, CleanupLevel determines how cleanup will be processed.

Execution context and suggested scheduling

Run the script as interactive user. The script should be executed manually.

A timeout of 720 seconds is recommended.

Parameters

ID Label Description
1 Disk Cleanup Campaign Id UID of the campaign to allow the user select which cleanup process will be done. Provide an empty GUID to enable execution without campaign
2 Cleanup Completed Campaign Id UID of the campaign to notify the user about the finish of the cleanup process
3 Remove Files Older Than Days Files accessed less recently than this threshold will be deleted. Provide number of days
4 Maximum Delay In Seconds Maximum random delay set to avoid overloading server hosting virtual machines. Provide number of seconds less than 600
5 Cleanup Level Cleanup level to support Chatbot solution. Relevant only in case empty guid is provided in DiskCleanupCampaignId parameter. Accepted values are [Light/Deep], by default Light is applied

Outputs

ID Label Type Description
1 Cleanup Space Size Space freed

Further Information

All files inside user temporary folder whose last access time is older than ‘RemoveFilesOlderThanDays’ input parameter, will be removed if deep cleanup option is selected in the campaign. Please note that LastAccessTime could be disabled by default in NTFS. If so, LastWriteTime will be used instead. Parameter ‘MaximumDelayInSeconds’ can be used to add random script execution delay. It should be used in virtualized environments to spread over time number of I/O requests on server hosting virtual machines.

Script System Cleanup

  • Version 3.0.0.0 – Added ‘Remove Memory Dump Files’ functionality
  • Version 2.0.2.0 – Bugfix for wrong SCCM cache path
  • Version 2.0.1.0 – Bugfix for user profiles with null LastUseTime property
  • Version 2.0.0.0 – Added SCCM cache cleanup and removal of unused user profiles
  • Version 1.0.0.0 – Initial release

Script Description

Performs WinSxS folder cleanup using DISM Windows tool, deletes SCCM cached files older than provided age in days, removes user profiles and all types of system memory dump files (small, kernel and full) unused for more than provided threshold in days.

Execution context and suggested scheduling

Run the script as local system. The script should be executed every 4 weeks.

A timeout of 720 seconds is recommended.

Parameters

ID Label Description
1 Maximum Delay In Seconds Maximum random delay set to avoid overloading server hosting virtual machines. Provide number of seconds less than 600
2 SCCM Cache Files Creation Age In Days File age threshold to delete Configuration Manager cache older or equal age. Provide 0 to ignore
3 User Profile Last Use Time In Days User profile age threshold to remove older or equal age. Provide 0 to ignore
4 Skip User Profiles List List of comma-separated profile names to be omitted. Provided names should be identical to user SAMAccountName Active Directory property. Special accounts are skipped by default
5 Dump Files Older Than Days File age threshold to remove older or equal age. Provide 0 to ignore

Outputs

ID Label Type Description
1 Cleanup Space Size Space freed

Further Information

Parameter ‘MaximumDelayInSeconds’ can be used to add random script execution delay. It should be used in virtualized environments to spread over time number of I/O requests on server hosting virtual machines.
SCCM cache cleanup does not work with Configuration Manager older than 2012.

Restrictions

  • The script is designed to remove memory dumps only from default locations (%SystemRoot%\MEMORY.DMP and %SystemRoot%\Minidump).

Content

Campaigns
Remote Actions

Required Modules

Nexthink Act
Nexthink Engage

Platforms

Windows

Compatibility

V6.14 and later
Thank you!