Powershell Try Catch print inner exception

Iterate over all innerExceptions

try {
    $transfer.ScriptTransfer()
} catch {
    $ex = $_.Exception
    while ($ex) {
        Write-Host $ex.Message
        $ex = $ex.InnerException
    }
}