Solved

Delete all Mailboxes in OU with Exchange 2007 Management Shell

Posted on 2009-05-12
5
600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
User (Manager) needs all Inbox/Sent items from various users. 5 20
eFolder Discontinued Product Keys No Longer Available 2 25
Exchange 2016 OWA 3 61
exchange 2007 1 16
Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create a Distribution Group 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 Recipients >>…
In this video we show how to create an Address List 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 Organization >> Ad…

726 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