Last active
March 13, 2016 12:46
-
-
Save Ambalus/f1dd731db05f8b14af3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $OtherCleanPathsArr = | |
| "C:\Temp\*", | |
| "C:\Windows\Temp\*" | |
| #системные пути для очистки | |
| $InProfilesCleanPathsArr = | |
| "\AppData\Local\Temp\*", | |
| "\AppData\Local\*.auc", | |
| "\AppData\Local\Microsoft\Terminal Server Client\Cache\*", | |
| "\AppData\Local\Microsoft\Windows\Temporary Internet Files\*", | |
| "\AppData\Local\Microsoft\Windows\WER\ReportQueue\*", | |
| "\AppData\Local\Microsoft\Windows\Explorer\*", | |
| "\AppData\Local\Google\Chrome\User Data\Default\Cache\*", | |
| "\AppData\Local\Google\Chrome\User Data\Default\Media Cache\*", | |
| "\AppData\Local\Opera Software\Opera Stable\*", | |
| "\AppData\Local\Mozilla\Firefox\Profiles\*" | |
| #пути в профилях для очистки | |
| #извлекли из реестра местоположение профилей, сформировали список | |
| $Profiles = Get-ChildItem (Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList").ProfilesDirectory -Exclude "Администратор", "Administrator", "Setup", "Public", "All Users", "Default User" | |
| #чистим общие папки временных файлов | |
| ForEach ($Path in $OtherCleanPathsArr) { | |
| Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| #чистим папки временных файлов по профилям | |
| ForEach ($Profile in $Profiles) { | |
| echo $Profile | |
| ForEach ($Path in $InProfilesCleanPathsArr) { | |
| echo " ~"$Path | |
| Remove-Item -Path $Profile$Path -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment