Solved

Delete all Mailboxes in OU with Exchange 2007 Management Shell

Posted on 2009-05-12
5
602 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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Read this checklist to learn more about the 15 things you should never include in an email signature.
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

688 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