-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean
42 lines (24 loc) · 1.29 KB
/
clean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$WinTemp = "c:\Windows\Temp\*"
#1# Empty Recycle Bin #
write-Host "Emptying Recycle Bin." -ForegroundColor Cyan
$objFolder.items() | %{ remove-item $_.path -Recurse -Confirm:$false}
#2# Remove Temp
write-Host "Removing Temp" -ForegroundColor Green
Set-Location “C:\Windows\Temp”
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue
Set-Location “C:\Windows\Prefetch”
Remove-Item * -Recurse -Force -ErrorAction SilentlyContinue
Set-Location “C:\Documents and Settings”
Remove-Item “.\*\Local Settings\temp\*” -Recurse -Force -ErrorAction SilentlyContinue
Set-Location “C:\Users”
Remove-Item “.\*\Appdata\Local\Temp\*” -Recurse -Force -ErrorAction SilentlyContinue
#3# Running Disk Clean up Tool
write-Host "Finally now , Running Windows disk Clean up Tool" -ForegroundColor Cyan
cleanmgr /sageset:4
pause
cleanmgr /sagerun:4
sleep 5
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion | Sort-Object -Property DisplayName -Unique | Format-Table -AutoSize > "$env:SystemDrive\programas_instalados.txt"
Remove-Item (Get-PSReadlineOption).HistorySavePath
write-host "Cleanup Finished" -ForegroundColor red
sleep 5