function Remove-ITDExpiredFiles {
    [CmdletBinding()]
    param (
        [string]
        $ComputerName,

        [switch]
        $WhatIf,

        [PSCredential]
        $Credential
    )
    Begin {
        Write-Verbose -Message "Start Remove-ITDExpiredFiles"
    }
    Process {
        $FilesRemovedSuccess = @()
        $FilesRemovedFailure = @()
        $GetITDExpiredFilesAutoParams += @{}

        If ($PSBoundParameters.ContainsKey('ComputerName')) {
            Write-Verbose -Message "ComputerName parameter found"
            $GetITDExpiredFilesParams += @{
                ComputerName = $ComputerName;
            }
        }
            
        If ($PSBoundParameters.ContainsKey('Credential')) {
            Write-Verbose -Message "Credential parameter found"
            $GetITDExpiredFilesParams += @{
                Credential = $Credential;
            }
        }
        $FilesToRemove = Get-ITDExpiredFiles @GetITDExpiredFilesParams
        Write-Verbose -Message ("Found " + $FilesToRemove.count + " expired files to remove")

        ForEach ($File in $FilesToRemove) {
            Write-Verbose -Message ("Start~" + $File.PSComputerName + "~" + $File.FullName )
            $InvokeCommandParams = @{
                ComputerName = $File.PSComputerName;
                Credential   = $Credential;
                ErrorAction  = 'Stop';
                ArgumentList = @($File.FullName);
                ScriptBlock  = { Get-Item -Path $args[0] | Remove-Item }
            }

            switch ($WhatIf) {
                $true {
                    try {
                        Write-Verbose -Message ("Process~" + $File.PSComputerName + "~" + $File.FullName + " removed")
                        Write-Host -Message ($Server.ComputerName + " -- " + 'What if: Performing the operation "Remove File" on target ' + $File.FullName)                        
                        # log success
                        $FilesRemovedSuccess += [PSCustomObject]@{
                            ComputerName = $File.PSComputerName;
                            Name = $File.Fullname;
                            Timestamp = (Get-Date).tostring("yyyy/MM/dd HH:mm:ss")
                        }
                        Write-Output $File
                    }
                    catch {
                        Write-Verbose -Message ("Process~" + $File.PSComputerName + "~" + $File.FullName + " failure")
                        # log failure
                        $FilesRemovedFailure += [PSCustomObject]@{
                            ComputerName = $File.PSComputerName;
                            Name = $File.Fullname;
                            Timestamp = (Get-Date).tostring("yyyy/MM/dd HH:mm:ss")
                        }
                    }                    
                }
                Default {
                    try {
                        Invoke-Command @InvokeCommandParams
                        Write-Verbose -Message ("Process~" + $File.PSComputerName + "~" + $File.FullName + " removed")
                        # log success
                        $FilesRemovedSuccess += [PSCustomObject]@{
                            ComputerName = $File.PSComputerName;
                            Name = $File.Fullname;
                            Timestamp = (Get-Date).tostring("yyyy/MM/dd HH:mm:ss")
                        }
                        Write-Output $File
                    }
                    catch {
                        Write-Verbose -Message ("Start~" + $File.PSComputerName + "~" + $File.FullName + " failure")
                        # log failure
                        $FilesRemovedFailure += [PSCustomObject]@{
                            ComputerName = $File.PSComputerName;
                            Name = $File.Fullname;
                            Timestamp = (Get-Date).tostring("yyyy/MM/dd HH:mm:ss")
                        }
                    }
                }
            }
            Write-Verbose -Message ("End~" + $File.PSComputerName + "~" + $File.FullName )
        }
    }
    End {        
        Write-Verbose -Message "End   Remove-ITDExpiredFilesAuto"
    }
}