Requests for Automation

Empty Downloads folder for all users script

I'm looking for a script that could be ran at regular intervals to empty all downloads folders (standard windows 10 default downloads location) of all local user profiles with provided local admin credentials.

This request was archived: Solved by user in comment

Gravatar for Andy Martin
Andy Martin 8 months ago

I was able to script this myself using executepowershell ps1 file.

The powershell script is as follows:

foreach($userfolder in (Get-ChildItem c:\users)){

    if(Test-Path "C:\Users\$($\Downloads"){

        $path = "C:\Users\$($\Downloads"

        Get-ChildItem -Path $path -Recurse| Foreach-object {Remove-item -Recurse -path $_.FullName }


        Write-Warning "Folder not found for $($"



For the procedure I used impersonateUser and admin as the user, with local admin password, and domain blank.

Then executePowershell below pointing to the location of the ps1 file.

Works excellent.

Gravatar for Andy Martin
Andy Martin 9 months ago

I would also assume it should delete the recycling bin contents after as well.


  • Request Archived
  • 0 Votes
  • Open for 9 months
  • Created by Andy Martin