Skip to content

Instantly share code, notes, and snippets.

@taco-shellcode
Last active November 17, 2023 20:27
Show Gist options
  • Save taco-shellcode/b124b103392788f6633e9e38a0e93d1b to your computer and use it in GitHub Desktop.
Save taco-shellcode/b124b103392788f6633e9e38a0e93d1b to your computer and use it in GitHub Desktop.
function Export-Events ($events, $outputPath) {
$formattedEvents = $events | ForEach-Object {
$_ | ForEach-Object {
New-Object PSObject -Property ([ordered]@{Action = $_.Action; AttachmentName = $_.AttachmentName; Date = $_.Date; Division = $_.Division; Recipient = $_.Recipient; SamAccountName = $_.SamAccountName; Sender = $_.Sender; Subject = $_.Subject;})
}
}
$formattedEvents | Export-Csv $outputPath -NoTypeInformation
$gui.LogTextBox.Dispatcher.Invoke('Normal', [action]{$gui.LogTextBox.AppendText("$(Get-Date) - Data has been exported to $outputPath`r`n")})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment