Functions/Remove-DownloadFolderItems.ps1


function Remove-DownloadFolderItems {
    [CmdletBinding()]
    param (
        # [Parameter()] [string] $ParameterName
    )

    $DownloadFolder = "$($env:USERPROFILE)\Downloads"

    $Items = Get-ChildItem $DownloadFolder -File

    $RemoveMatch = @()
    $RemoveMatch += "*.ica"
    $RemoveMatch += "*.rdp"

    if ($Items) {
        foreach ($rm in $RemoveMatch) {
            $Items.FullName -like $rm | ForEach-Object {
                Write-Host "Removing: $($_)" -ForegroundColor Yellow
                Remove-Item $_
            }
        }
    }
}