A
A
arkenroziyev2022-03-16 13:23:05
Microsoft Exchange
arkenroziyev, 2022-03-16 13:23:05

How to delete all emails in Exchange?

Good afternoon! Please tell me how you can delete all letters on the server with one command and the letters of an individual user.
It is necessary to delete all letters and calendars on the user's mail server. Without the possibility of recovery. In fact, you need to clear the entire server from letters.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Bezrukov, 2022-03-16
@NortheR73

Once and forever:

Get-MailboxDatabase | Dismount-Database
Get-MailboxDatabase | Remove-MailboxDatabase -Confirm:$false

Then delete the corresponding files from the disk
Less radical methods: for example, one and two

A
akelsey, 2022-03-16
@akelsey

Delete the box, create the box.

A
arkenroziyev, 2022-03-16
@arkenroziyev

I found a command to delete all letters, but is it possible to use a cycle with received addresses and file a delete cycle
1. Variable to receive all mailboxes

$address = Get-MailBox | select -Expand EmailAddresses | % {$_.SmtpAddress}

2. Command to delete all letters in the mailbox
Search-Mailbox -Identity почтовый_адрес -SearchQuery "Kind:Email" -DeleteContent

How can I wrap this command in a loop now?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question