Step-by-Step Guide to Configuring CleanTempShutdown System performance often degrades due to the accumulation of temporary files and unmanaged background processes during prolonged uptime. CleanTempShutdown addresses this issue by automating directory cleanup and enforcing secure power-down sequences. This technical guide covers installation, configuration, and automation steps to implement the utility effectively. Prerequisites and System Verification
Before initiating the configuration process, ensure your environment meets the minimum operational standards. CleanTempShutdown requires administrative permissions to access restricted system directories and interact with the operating system kernel.
Operating System: Windows ⁄11 or Windows Server 2016 and later.
Execution Environment: PowerShell 5.1 or PowerShell Core 7.0+.
Access Rights: Administrative privileges (Run as Administrator).
To verify your environment, launch an elevated PowerShell prompt and validate your execution policy: powershell Get-ExecutionPolicy Use code with caution.
If the execution policy is restricted, modify it to allow local script execution: powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser Use code with caution. Step 1: Initialize the Directory Structure
CleanTempShutdown relies on a standardized directory structure to store its primary scripts, runtime configurations, and diagnostic logs. Creating this foundation prevents path resolution errors during script execution. Open an elevated PowerShell window.
Execute the following commands to construct the directory layout: powershell
New-Item -ItemType Directory -Path “C:\Program Files\CleanTempShutdown” -Force New-Item -ItemType Directory -Path “C:\Program Files\CleanTempShutdown\Logs” -Force New-Item -ItemType Directory -Path “C:\Program Files\CleanTempShutdown\Config” -Force Use code with caution. Step 2: Establish the Core Configuration Profile
The application utilizes a JSON configuration file to manage variable paths, retention windows, and system behavior. Storing these values within a discrete file eliminates the need to modify the core execution script for future adjustments.
Create a file named config.json inside the C:\Program Files\CleanTempShutdown\Config</code> directory, and populate it with the following configuration:
{ “TargetDirectories”: [ “C:\Windows\Temp”, “C:\Users\\AppData\Local\Temp” ], “ExclusionList”: [ “.log”, “important_session.tmp” ], “RetentionDays”: 7, “Logging”: { “Enabled”: true, “LogPath”: “C:\Program Files\CleanTempShutdown\Logs\cleanup.log” }, “ShutdownBehavior”: { “ForceCloseApps”: true, “DelaySeconds”: 60 } } Use code with caution. Key Parameter Definitions
TargetDirectories: Array of absolute paths designated for file purging. Wildcards are supported for targeting user-specific profiles.
ExclusionList: String patterns representing files or extensions that must remain untouched during the cleanup cycle.
RetentionDays: The age threshold (in days) a file must reach before it becomes eligible for deletion.
ForceCloseApps: Dictates whether the system terminates unresponsive applications immediately during the shutdown phase. Step 3: Implement the CleanTempShutdown Engine
The core engine parses the config.json profile, scans the defined target paths, filters items based on age and exclusions, deletes qualified assets, and triggers the shutdown routine.
Save the following code block as CleanTempShutdown.ps1 inside C:\Program Files\CleanTempShutdown</code>: powershell
Leave a Reply