Does “New-ComplianceSearchAction -Purge” really purge the mailbox like it should?

New-ComplianceSearchAction -SearchName "GDPR Fuckups" -Purge

Are you sure you want to perform this action?
This operation will make message items meeting the criteria of the compliance search “Remove Vetting messages” completely inaccessible to users. There is no automatic method to undo the removal of these message items.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): A

soundsgood

Continue reading “Does “New-ComplianceSearchAction -Purge” really purge the mailbox like it should?”

Advertisements

Harder, Better, Faster, Stronger…”-filter” vs. “where-object”

eeac7149d557a4ef83b3f499c24563e8--simpsons-meme-the-simpsons

Some time ago I was measuring execution times of posh lines with -filter and where-object.

The difference is significant:

PS D:\AdminTools> measure-command {Get-remotemailbox -Filter {RecipientTypeDetails -eq "RemoteRoomMailbox" -and name -like "*people*"}}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 756
Ticks             : 7564893
TotalDays         : 8,75566319444444E-06
TotalHours        : 0,000210135916666667
TotalMinutes      : 0,012608155
TotalSeconds      : 0,7564893
TotalMilliseconds : 756,4893

PS D:\AdminTools> measure-command {Get-remotemailbox | ? {$_.RecipientTypeDetails -eq "RemoteRoomMailbox" -and $_.name -like "*people*"}}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 18
Milliseconds      : 415
Ticks             : 184153984
TotalDays         : 0,000213141185185185
TotalHours        : 0,00511538844444444
TotalMinutes      : 0,306923306666667
TotalSeconds      : 18,4153984
TotalMilliseconds : 18415,3984

We can see here that commands with -filter can be significantly quicker – almost 3 times quicker.

Where does it come from you may ask? Well, the “-filter” tells the source to filter the results BEFORE sending back to the requester, whilst when using “where-object” tells the source to send ALL results to the requster and later the requester picks the right records.