@@ -30,7 +30,7 @@ function Invoke-CIPPStandardEnableLitigationHold {
3030 param ($Tenant , $Settings )
3131 # #$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'EnableLitigationHold'
3232
33- $MailboxesNoLitHold = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-Mailbox' - cmdparams @ { Filter = ' LitigationHoldEnabled -eq "False"' } - Select ' UserPrincipalName,PersistedCapabilities,LitigationHoldEnabled' | Where-Object { $_.PersistedCapabilities -contains ' BPOS_S_DlpAddOn' -or $_.PersistedCapabilities -contains ' BPOS_S_Enterprise' }
33+ $MailboxesNoLitHold = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-Mailbox' - cmdParams @ { Filter = ' LitigationHoldEnabled -eq "False"' } - Select ' UserPrincipalName,PersistedCapabilities,LitigationHoldEnabled' | Where-Object { $_.PersistedCapabilities -contains ' BPOS_S_DlpAddOn' -or $_.PersistedCapabilities -contains ' BPOS_S_Enterprise' }
3434
3535 if ($Settings.remediate -eq $true ) {
3636 if ($null -eq $MailboxesNoLitHold ) {
@@ -44,19 +44,19 @@ function Invoke-CIPPStandardEnableLitigationHold {
4444 Parameters = @ { Identity = $_.UserPrincipalName ; LitigationHoldEnabled = $true }
4545 }
4646 }
47- if ($Settings .days -ne $null ) {
47+ if ($null -ne $Settings .days ) {
4848 $params.CmdletInput.Parameters [' LitigationHoldDuration' ] = $Settings.days
4949 }
5050 $params
5151 }
5252
5353
54- $BatchResults = New-ExoBulkRequest - tenantid $tenant - cmdletArray @ ($Request )
54+ $BatchResults = New-ExoBulkRequest - tenantid $Tenant - cmdletArray @ ($Request )
5555 $BatchResults | ForEach-Object {
5656 if ($_.error ) {
5757 $ErrorMessage = Get-NormalizedError - Message $_.error
5858 Write-Host " Failed to Enable Litigation Hold for $ ( $_.Target ) . Error: $ErrorMessage "
59- Write-LogMessage - API ' Standards' - tenant $tenant - message " Failed to Enable Litigation Hold for $ ( $_.Target ) . Error: $ErrorMessage " - sev Error
59+ Write-LogMessage - API ' Standards' - tenant $Tenant - message " Failed to Enable Litigation Hold for $ ( $_.Target ) . Error: $ErrorMessage " - sev Error
6060 }
6161 }
6262 } catch {
0 commit comments