Generally, to deal with non-terminating errors (where there's no expected terminating errors happening), I prefer to use the -ErrorVariable parameter. For example:
Get-ADUser -Filter {Enabled = 'False'} -Properties Modified | Where Modified -LT (Get-Date).AddDays(-30) | Remove-ADUser -Confirm:$false -ErrorVariable removeUserErrors # Here, $removeUserErrors will be an empty collection if everything worked, or will contain # one or more ErrorRecord objects if any of the calls to Remove-ADUser failed. if ($removeUserErrors.Count -gt 0) { $removeUserErrors | Out-File some-File.txt }