Skip to main content

Posts

Showing posts from October, 2015

Windows / Sharepoint / User Temp files Auto deletion PowerShell Script

Windows / Sharepoint / User Temp files Auto deletion PowerShell Script

+++++++++++++++++++++++++++++++++++++++++
$tempfolders = @("C:\Windows\Temp\*", "C:\Users\*\Appdata\Local\Temp\*", "C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\*", "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\PETGeneral\DMSTemp\*" ,"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\PETV2\DMSTemp\*")

Remove-Item $tempfolders -force -recurse

+++++++++++++++++++++++++++++++++++++++++

Copy above text in PS1 file. e.g. TempFileDeletion.ps1

Schedule it with Windows Task Scheduler :