Forum Discussion

BarGraph2020's avatar
BarGraph2020
Frequent Visitor
4 years ago

How to use FOR loop in a powershell command in this audit log retrieval.

Powershell experts please pitch in your inputs.

 

I need a file for audit log from PowerBI for an entire month. However Powerbiactivityevent can bring data for one single day. Is there a way to loop this in a for loop for every single day of the month and generate a single file.

 

 

Cmd to run /loop

$activities = Get-PowerBIActivityEvent -StartDateTime '2021-12-15T00:00:00' -EndDateTime '2021-12-15T23:59:59' -ActivityType 'ViewReport'| ConvertFrom-Json $activities | Export-csv -Path "C:\Users\gd58\Desktop\TEMP\PowerBIAuditLog.csv" -NoTypeInformation

3 Replies