Effortless PowerShell Script to Monitor Disk Space and Automatically Clean Up Files When Usage Exceeds 70%

PowerShell Script # Parameters $driveLetter = “C:” # Specify the drive letter to monitor $threshold = 70 # Set the disk usage threshold percentage $folderToClean = “C:Temp” # Specify the folder from which files will be deleted $logFile = “C:TempCleanupLog.txt” # Specify the log file location # Function to log messages function Log-Message { param […]