Solved

Delete all Mailboxes in OU with Exchange 2007 Management Shell

Posted on 2009-05-12
5
590 Views
Last Modified: 2012-06-21
Hello,
Looking for the command to fully delete all the Exchange Mailboxes contained in an OU.
0
Comment
Question by:adamant40
  • 3
5 Comments
 
LVL 32

Accepted Solution

by:
gupnit earned 300 total points
ID: 24371393
Hi,
Here is your command:
ForEach ($mbx in Get-Mailbox -OrganizationalUnit YOUROU) { Remove-Mailbox -Identity $mbx -Permanent}  
Let me know
Thanks
Nitin Gupta (gupnit)
0
 
LVL 24

Assisted Solution

by:Rajith Enchiparambil
Rajith Enchiparambil earned 200 total points
ID: 24372661
A simple one

get-mailbox -organizationalunit ouname | remove-mailbox -confirm$false

If you don't put -confirm$false, it will prompt you to review your decision.
0
 

Author Comment

by:adamant40
ID: 24375439
Hi Gupnit,
When I run
ForEach ($mbx in Get-Mailbox -OrganizationalUnit YOUROU) { Remove-Mailbox -Identity $mbx -Permanent}
It returns the error below. It seems very close, just missing a parameter. But I can't find it online.
Remove-Mailbox : Missing an argument for parameter 'Permanent'. Specify a param
eter of type 'System.Boolean' and try again.
At line:1 char:99
+ ForEach ($mbx in GET-Mailbox -OrganizationalUnit Test2) { Remove-Mailbox -Ide
ntity $mbx -Permanent} <<<<
Remove-Mailbox : Missing an argument for parameter 'Permanent'. Specify a param
eter of type 'System.Boolean' and try again.
At line:1 char:99
+ ForEach ($mbx in GET-Mailbox -OrganizationalUnit Test2) { Remove-Mailbox -Ide
ntity $mbx -Permanent} <<<<
0
 

Author Comment

by:adamant40
ID: 24375947
Hi Rajith,
When I run your command I get the error:
Remove-Mailbox : A parameter cannot be found that matches parameter name 'confi
rm$false'.
At line:1 char:69
+ get-mailbox -organizationalunit test2 | remove-mailbox -confirm$false <<<<
I will try to find the correct syntax.

0
 

Author Closing Comment

by:adamant40
ID: 31580791
both answers needed tweeking but allowed me to get the task accomplished.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now