How can we empty Deleted Item Folders from On-premises Exchange server using script?

Copper Contributor

Scenario: As i am migrating the mailbox, requirement is to empty the mailbox's deleted items folder and instead of doing manually to individual usermailbox, i tried to do from Exchange Management shell using command.

Search-Mailbox parameter command is deprecated so i cannot use those command as suggested in the internet related articles. 

 

How can i empty deleted item folders from Mailbox server? 

3 Replies
Search-Mailbox works just fine on-premises, it's only deprecated in Exchange Online.
hi,
Search-Mailbox command does not work in Exchange On-Premise 2019 server. I tried with importing command but not worked.