Solved

Delete all Mailboxes in OU with Exchange 2007 Management Shell

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

Question has a verified solution.

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

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…
We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
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

809 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