Translate

Ciscenje

Evo jedna mala skripra koja cisti prostor na C disku. Pokretanjem skripte brisu se svi log fajlovi, privremeni TEMP fajlovi, Svi skinuti updateovi i na kraju pokrece Disk Clinup. Skriptu je potrebno pokrenuti kao administrator.

#################################################

### Ciscenja logova ###
wevtutil el | Foreach-Object {Write-Host "Clearing $_"; wevtutil cl "$_"}

### Ciscenje updateova ###
Stop-Service wuauserv
Remove-Item C:\windows\SoftwareDistribution\* -recurse
Start-Service wuauserv

### Disk clinup ###
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace(0xA)
$temp = get-ChildItem "env:\TEMP"
$temp2 = $temp.Value
$swtools = "c:\SWTOOLS\*"
$WinTemp = "c:\Windows\Temp\*"

Remove-Item -Recurse  "$temp2\*" -Force -Verbose
$objFolder.items() | %{ remove-item $_.path -Recurse -Confirm:$false}
Remove-Item -Recurse $WinTemp -Force
cleanmgr /sagerun:1 | out-Null

$([char]7)
Sleep 1
$([char]7)
Sleep 1
###############################################



Нема коментара:

Постави коментар