Description

This Script Purge Multiple Mailboxes on Exchange Server.

Prerequisites:
  a)List of Mailbox Display Name in a text file.
  b)Exchange Server Name.
  c)Required Exchange Permissions to perform this action.

Script

PowerShell
Edit|Remove
#Getting Display Name of the mailbox 
 
$FilePath = Read-Host "Enter FilePath To Get Mailbox Display Name" 
$servername = Read-Host "Enter Exchange Server Name" 
$MDN = Get-Content $FilePath 
 
#Exchange Info 
Foreach ($SubMDN in $MDN) 
{ 
 
$purge = Get-WmiObject -Query "select * from Exchange_Mailbox Where MailboxDisplayName='$SubMDN'" -Namespace "root/MicrosoftExchangeV2" -ComputerName $servername 
$purge.purge() 
 
Write-host "Name: "$SubMDN 
 
}