Last active
October 3, 2019 22:08
-
-
Save SQLvariant/ad1e4a52be3e57531e1093566b131ed1 to your computer and use it in GitHub Desktop.
Export Power BI Audit Logs to .JSON files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90..1 | | |
foreach { | |
$Date = (((Get-Date).Date).AddDays(-$_)) | |
$StartDate = (Get-Date -Date ($Date) -Format yyyy-MM-ddTHH:mm:ss) | |
$EndDate = (Get-Date -Date ((($Date).AddDays(1)).AddMilliseconds(-1)) -Format yyyy-MM-ddTHH:mm:ss) | |
Get-PowerBIActivityEvent -StartDateTime $StartDate -EndDateTime $EndDate -ResultType JsonString | | |
Out-File -FilePath "c:\temp\PowerBIAuditLogs\PowerBI_AudititLog_$(Get-Date -Date $Date -Format yyyyMMdd).json" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90..1 | | |
foreach { | |
$Date = (((Get-Date).Date).AddDays(-$_)) | |
"$Date" | |
$StartDate = (Get-Date -Date ($Date) -Format yyyy-MM-ddTHH:mm:ss) | |
$EndDate = (Get-Date -Date ((($Date).AddDays(1)).AddMilliseconds(-1)) -Format yyyy-MM-ddTHH:mm:ss) | |
Get-PowerBIActivityEvent -StartDateTime $StartDate -EndDateTime $EndDate -ResultType JsonString | | |
Out-File -FilePath c:\temp\PowerBIAuditLogs\PowerBI_AudititLogs.json -Append | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment