From 16db6cf5bfda262558fcaee3ab1f49d49d43c247 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 8 Sep 2022 14:41:54 -0400 Subject: [PATCH] added cleanmgr to script --- Cleanup-SystemTempFiles.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cleanup-SystemTempFiles.ps1 b/Cleanup-SystemTempFiles.ps1 index 8be4b0c..5ab3bbd 100644 --- a/Cleanup-SystemTempFiles.ps1 +++ b/Cleanup-SystemTempFiles.ps1 @@ -75,6 +75,11 @@ If ( IsAdmin ) ForEach ( $tempfile in $AutoCADTempFiles ) { Remove-Item $tempfile -Force -ErrorAction SilentlyContinue } } } + + # Silently run cleanmgr.exe with default settings + LogMsg "Running cleanmgr.exe with default settings" + Try { Start-Process "cleanmgr.exe" -ArgumentList "/VERYLOWDISK" } + Catch { LogErr $_.Exception.Message } } # Only run this section if we don't have administrative privileges @@ -98,4 +103,9 @@ Else ForEach ( $tempfile in $AutoCADTempFiles ) { Remove-Item $tempfile -Force -ErrorAction SilentlyContinue } } } + + # Silently run cleanmgr.exe with default settings + LogMsg "Running cleanmgr.exe with default settings" + Try { Start-Process "cleanmgr.exe" -ArgumentList "/VERYLOWDISK" } + Catch { LogErr $_.Exception.Message } }