diff --git a/Cleanup-SystemTempFiles.ps1 b/Cleanup-SystemTempFiles.ps1 index bba01c2..e8a7d90 100644 --- a/Cleanup-SystemTempFiles.ps1 +++ b/Cleanup-SystemTempFiles.ps1 @@ -1,21 +1,5 @@ . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) -# Function to enumerate all user profile folders -Function Get-UserProfiles { - $ProfilePath = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory).ProfilesDirectory - $UserProfilePaths = @() - ForEach ( $userProfile in (Get-ChildItem -Path $ProfilePath | Where-Object { $_.PSIsContainer }) ) { - $UserProfilePaths += ,@($userProfile.FullName) - } - Return $UserProfilePaths -} - -# Function to determine if an app is running -Function IsRunning ([Parameter(ValueFromPipeline=$true)][string]$Name) { - $RunningInstances = Get-Process | Where-Object { $_.Name -ilike $Name } - If ( $RunningInstances ) { Return $true } Else { Return $false } -} - # When deleting temp files en masse, only delete files/folders older than the number of days specified here $OlderThan = 7 $TimeDelta = New-TimeSpan -Days $OlderThan