Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
BarGraph2020
Frequent Visitor

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 3
Anonymous
Not applicable

Hi @BarGraph2020 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. 

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @BarGraph2020 ,

 

Here is a blog talking about How you can store All your Power BI Audit Logs easily and indefinitely in Azure - Reporting/Analytic... please kindly refer to.

 

Best Regards,
Eyelyn Qin

 

smpa01
Community Champion
Community Champion

@BarGraph2020  Wouldn't stackoverflow  be a better place to get to it quickest?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.