Write-Progress -Activity “Preparing” -Status “Retrieving mailbox list” -PercentComplete 0
$rooms=get-mailbox -resultsize unlimited -warningaction:silentlycontinue| where {$_.name -notlike “*test*”}
$count=$rooms.count
foreach($room in $rooms)
{
$i=$i+1
$percentage=$i/$count*100
Write-Progress -Activity “Collecting mailbox details” -Status “Processing mailbox $i of $Count – $room” -PercentComplete $percentage
$room | search-mailbox -searchquery “kind:calendar from:tcox” -deletecontent -force
}
more details from TechNet
https://blogs.technet.microsoft.com/exchange/2010/10/27/removing-specific-messages-from-your-exchange-server/
note: credit goes to Mr R. very good PS scripts.