update
This commit is contained in:
+21
-15
@@ -300,20 +300,25 @@ Function Clean-Files($Items,$SageSetNumber) {
|
||||
}
|
||||
|
||||
## Get the specified cleaning categories and run each one
|
||||
If ( $All ) {
|
||||
$User = $true
|
||||
$System = $true
|
||||
$WindowsUpdate = $true
|
||||
$WindowsPreviousVersions = $true
|
||||
$Invasive = $true
|
||||
$Misc = $true
|
||||
}
|
||||
If ( $User ) { Clean-Files $UserItems $UserItemsSageSetNumber }
|
||||
If ( $System ) { Clean-Files $SystemItems $SystemItemsSageSetNumber }
|
||||
If ( $WindowsUpdate ) { Clean-Files $WindowsUpdateItems $WindowsUpdateItemsSageSetNumber }
|
||||
If ( $WindowsPreviousVersions ) { Clean-Files $WindowsPreviousVersionsItems $WindowsPreviousVersionsItemsSageSetNumber }
|
||||
If ( $Invasive ) { Clean-Files $InvasiveItems $InvasiveItemsSageSetNumber }
|
||||
If ( $Misc ) { Clean-Files $MiscItems $MiscItemsSageSetNumber }
|
||||
## Only run if cleanmgr.exe is present on the target endpoint.
|
||||
If ( Test-Path "${Env:SYSTEMROOT}\System32\cleanmgr.exe" )
|
||||
{
|
||||
If ( $All ) {
|
||||
$User = $true
|
||||
$System = $true
|
||||
$WindowsUpdate = $true
|
||||
$WindowsPreviousVersions = $true
|
||||
$Invasive = $true
|
||||
$Misc = $true
|
||||
}
|
||||
If ( $User ) { Clean-Files $UserItems $UserItemsSageSetNumber }
|
||||
If ( $System ) { Clean-Files $SystemItems $SystemItemsSageSetNumber }
|
||||
If ( $WindowsUpdate ) { Clean-Files $WindowsUpdateItems $WindowsUpdateItemsSageSetNumber }
|
||||
If ( $WindowsPreviousVersions ) { Clean-Files $WindowsPreviousVersionsItems $WindowsPreviousVersionsItemsSageSetNumber }
|
||||
If ( $Invasive ) { Clean-Files $InvasiveItems $InvasiveItemsSageSetNumber }
|
||||
If ( $Misc ) { Clean-Files $MiscItems $MiscItemsSageSetNumber }
|
||||
|
||||
} Else { Write-Output "cleanmgr.exe does not exist!" }
|
||||
|
||||
## Function to delete each iTunes backup directory
|
||||
Function Delete-iTunesBackups($dir) {
|
||||
@@ -335,7 +340,8 @@ If ( $iTunesBackups ) {
|
||||
|
||||
## List of accounts to exclude
|
||||
$ExcludedUsers = @("Public",
|
||||
"All Users")
|
||||
"All Users",
|
||||
"Administrator")
|
||||
|
||||
## Empty array to hold the user directories to clean
|
||||
$DirectoriesToProcess = @()
|
||||
|
||||
Reference in New Issue
Block a user