Hi,
So i want to write something that will read pages of logs from o365 and output to a csv but nothing i have tried or found so far works. Every attempt i make returns an output file of page 1 and that’s it.
I know for most on here this is probably a very easy task but has me stumped
I know the log interrogation works as if i call each page individually and append to the output file everything is there but this means lots of redundant code and i need to know how many pages to call.
I would like to be able to do something along the lines of below, but despite tweaking this is failing:
$Variable= $null
$Page = 1
do
{
Write-Host “Collecting logs - Page $Page…”
$CurrVariable = Get-MailDetailDlpPolicyReport -PageSize 5000 | Select Date, MessageID, SenderAddress, RecipientAddress, Subject, EventType, Action, DLPPolicy, TransportRule, UserAction, Justification, SensitiveInformationType, SensitiveInformationCount, SensitiveInformationConfidence
$Page++
$Variable+= $CurrVariable
}
until ($CurrMessages -eq $null)
If anyone can provide a steer it’s very much appreciated.
Thanks