param( [Parameter(Position=0, Mandatory=$true)] $To, [Parameter(Position=1, Mandatory=$true)] $From, [Parameter(Position=2, Mandatory=$true)] $SmtpServer ) function New-AuditLogReport { [CmdletBinding()] param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [Microsoft.Exchange.Management.SystemConfigurationTasks.AdminAuditLogEvent] $AuditLogEntry ) begin { $css = @' '@ $sb = New-Object System.Text.StringBuilder [void]$sb.AppendLine($css) [void]$sb.AppendLine("
| Exchange 2010 Administrator Audit Log Report for $((get-date).ToShortDateString()) | |||||
| Caller | ") [void]$sb.AppendLine("Run Date | ") [void]$sb.AppendLine("Succeeded | ") [void]$sb.AppendLine("Cmdlet | ") [void]$sb.AppendLine("Parameters | ") [void]$sb.AppendLine("Object Modified | ") [void]$sb.AppendLine("
| $($AuditLogEntry.Caller.split("/")[-1]) | ") [void]$sb.AppendLine("$($AuditLogEntry.RunDate.ToString()) | ") [void]$sb.AppendLine("$($AuditLogEntry.Succeeded) | ") [void]$sb.AppendLine("$($AuditLogEntry.cmdletname) | ") $cmdletparameters += $AuditLogEntry.cmdletparameters | %{ "$($_.name) : $($_.value)$cmdletparameters | ") [void]$sb.AppendLine("$($AuditLogEntry.ObjectModified) | ") [void]$sb.AppendLine("