Advertisement
drkn0x

picklerick

Mar 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Delets all files and folders in user's Temp folder.  
  2. Get-ChildItem "C:\users\*\AppData\Local\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue |
  3. Where-Object { ($_.CreationTime -lt $(Get-Date).AddDays(-$DaysToDelete))} |
  4. remove-item -force -Verbose -recurse -ErrorAction SilentlyContinue
  5. ## The contents of C:\users\$env:USERNAME\AppData\Local\Temp\ have been removed successfully!
  6.  
  7.                
  8. ## Remove all files and folders in user's Temporary Internet Files.  
  9. Get-ChildItem "C:\users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" `
  10. -Recurse -Force -Verbose -ErrorAction SilentlyContinue |
  11. Where-Object {($_.CreationTime -le $(Get-Date).AddDays(-$DaysToDelete))} |
  12. remove-item -force -recurse -ErrorAction SilentlyContinue
  13. ## All Temporary Internet Files have been removed successfully!
  14.  
  15. ## delete hidden install files
  16. Get-ChildItem "%windir%\$NT*" -Recurse -Force -ErrorAction SilentlyContinue | remove-item -force -Verbose -recurse -ErrorAction SilentlyContinue
  17.  
  18. ## delete prefetch files
  19. Get-ChildItem "c:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue | remove-item -force -Verbose -recurse -ErrorAction SilentlyContinue
  20.  
  21. ### Disable paging the executive
  22. Set-RegistryKey -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "DisablePagingExecutive" -Value 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement