z230
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# =====================================================================
|
||||
# clean_windows_temp_v1.1_2026-06-10.ps1
|
||||
# Verze: 1.1 | Datum: 2026-06-10
|
||||
# Popis: Vyčistí C:\Windows\Temp. Vyžaduje spuštění JAKO SPRÁVCE.
|
||||
# v1.1: před mazáním převezme vlastnictví (takeown) a přidá
|
||||
# Administrators plná práva (icacls) — v1.0 selhala na ACL
|
||||
# souborů wct*.tmp vlastněných systémovým účtem.
|
||||
# (SoftwareDistribution\Download už vyčistila v1.0.)
|
||||
# =====================================================================
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
$before = (Get-PSDrive C).Free
|
||||
|
||||
Write-Host "Prebiram vlastnictvi C:\Windows\Temp (muze trvat par minut) ..."
|
||||
takeown /F 'C:\Windows\Temp' /R /D Y | Out-Null
|
||||
icacls 'C:\Windows\Temp' /grant 'Administrators:(OI)(CI)F' /T /C /Q | Out-Null
|
||||
|
||||
Write-Host "Mazu obsah C:\Windows\Temp ..."
|
||||
Get-ChildItem 'C:\Windows\Temp' -Force -ErrorAction SilentlyContinue |
|
||||
Remove-Item -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue
|
||||
|
||||
$left = (Get-ChildItem 'C:\Windows\Temp' -Recurse -Force -File -ErrorAction SilentlyContinue |
|
||||
Measure-Object Length -Sum).Sum
|
||||
$after = (Get-PSDrive C).Free
|
||||
Write-Host ("Uvolneno: {0:N2} GB | Zbyva v Temp: {1:N2} GB | Volno celkem: {2:N2} GB" -f `
|
||||
(($after-$before)/1GB), ($left/1GB), ($after/1GB))
|
||||
Read-Host "Hotovo - Enter pro zavreni"
|
||||
Reference in New Issue
Block a user