examples/Export-ActivityLog.ps1

[CmdletBinding()]
param(
    [Parameter()]
    [ValidateRange(1, 168)]
    [int]$Hours = 24,

    [Parameter()]
    [string]$OutputPath = '.\Datto-Activity-Log.csv'
)

Get-DattoActivityLog -Since $Hours -SinceUnits hours -All |
    Select-Object timestamp, requestId, targetType, targetId, targetDisplayName, clientName, interface, user, userRoles, ipAddress, action, messageEN, success |
    Export-Csv -LiteralPath $OutputPath -NoTypeInformation -Encoding UTF8

Get-Item -LiteralPath $OutputPath