@@ -43,15 +43,15 @@ function Push-AuditLogTenantDownload {
4343 Write-Information (' Audit Logs: Found {0} searches, begin downloading' -f $LogSearches.Count )
4444 foreach ($Search in $LogSearches ) {
4545 $SearchEntity = Get-CIPPAzDataTableEntity @LogSearchesTable - Filter " Tenant eq '$ ( $TenantFilter ) ' and RowKey eq '$ ( $Search.id ) '"
46- $SearchEntity. CippStatus = ' Processing'
46+ $SearchEntity | Add-Member - NotePropertyName CippStatus - NotePropertyValue ' Processing' - Force
4747 Add-CIPPAzDataTableEntity @LogSearchesTable - Entity $SearchEntity - Force
4848 try {
4949 Write-Information " Audit Log search: Processing search ID: $ ( $Search.id ) for tenant: $TenantFilter "
5050 $Downloads = New-CIPPAuditLogSearchResultsCache - TenantFilter $TenantFilter - searchId $Search.id
51- $SearchEntity. CippStatus = ' Downloaded'
51+ $SearchEntity | Add-Member - NotePropertyName CippStatus - NotePropertyValue ' Downloaded' - Force
5252 } catch {
5353 if ($_.Exception.Message -match ' Request rate is large. More Request Units may be needed, so no changes were made. Please retry this request later.' ) {
54- $SearchEntity. CippStatus = ' Pending'
54+ $SearchEntity | Add-Member - NotePropertyName CippStatus - NotePropertyValue ' Pending' - Force
5555 Write-Information " Audit Log search: Rate limit hit for $ ( $SearchEntity.RowKey ) ."
5656 if ($SearchEntity.PSObject.Properties.Name -contains ' RetryCount' ) {
5757 $SearchEntity.RetryCount ++
@@ -60,8 +60,8 @@ function Push-AuditLogTenantDownload {
6060 }
6161 } else {
6262 $Exception = [string ](ConvertTo-Json - Compress - InputObject (Get-CippException - Exception $_ ))
63- $SearchEntity | Add-Member - MemberType NoteProperty - Name Error - Value $Exception
64- $SearchEntity. CippStatus = ' Failed'
63+ $SearchEntity | Add-Member - MemberType NoteProperty - Name Error - Value $Exception - Force
64+ $SearchEntity | Add-Member - NotePropertyName CippStatus - NotePropertyValue ' Failed' - Force
6565 Write-Information " Error processing audit log rules: $ ( $_.Exception.Message ) "
6666 }
6767
0 commit comments