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 :
Run the below command in PowerShell for changing Execution Policy.
Its Done.
+++++++++++++++++++++++++++++++++++++++++
$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 :
Run the below command in PowerShell for changing Execution Policy.
Its Done.
It’s really a great to see the post like this which provides a meaningful data to someone who is new to this field, thanks for sharing it.
ReplyDeleteReach out to your customers within a short period of time anywhere and anytime in the world with email marketing, b2b marketing, list solutions.
Health Care CEO email Lists
Hospital CEO email Lists
Insurance companies CEO Email Lists
International CEO Email Lists
Pharmaceutical Industry CEO Email Lists
Automobile Industry CEO Email List
Software Companies CEO email list
BPO CEO Email List
InformationTechnology Mailing & Email Lists