I'm trying to run the below powershell script in desktop, but after running the flow nothing seems to happen. It runs, then ends without error.
The script executes correctly in Powershell.
Ultimately I won't need to export the csv, but drop the data in a dataverse table, or failing that upload the csv to sharepoint then have a cloud flow process the file and drop it in dataverse.
#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False
#Set Date Filters - past 24 hours!
$StartDate = (Get-Date).AddDays(-1)
$EndDate = Get-Date
#Filter Audit log to Find specific operations
$SiteURLs = @("https://company.sharepoint.com/")
$CSVFile = "C:\Temp\AuditLog1.csv"
$FileAccessOperations = @('PageViewed')
$SharePointLog = Search-UnifiedAuditLog -StartDate $StartDate -EndDate $EndDate -Operations $FileAccessOperations -ResultSize 5000 -ObjectIds $SiteURLs
$AuditLogResults = $SharePointLog.AuditData | ConvertFrom-Json | Select CreationTime,UserId,Operation, ObjectID,SiteUrl,SourceFileName,ClientIP
#Export Audit log results to CSV
$AuditLogResults
$AuditLogResults | Export-csv -Path $CSVFile -NoTypeInformation
#Disconnect Exchange Online
Disconnect-ExchangeOnline