[Last Call] Learn how to a build a cloud-first strategyRegister Now


Import-csv remove-mailbox - how to choose [a] yes to all in the syntax of the command?

Posted on 2007-10-08
Medium Priority
Last Modified: 2012-05-05
Here is the syntax of the command I am using
Import-Csv recipients.csv | foreach {Remove-Mailbox -identity $_.Identity}

This command works, but i have to choose yes for every single line and there are 1200 mailboxes I am removing.
I get this response for every mailbox in the script

Are you sure you want to perform this action?
Removing the Mailbox "<domain>\<username>" will remove the Windows user object and
 mark the mailbox in the database for removal.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):A

Choosing A only applies to that single mailbox, not the whole string.

Is there a way to add a command to have it select A for Yes to all for the whole string of mailboxes?
Question by:Robguad
1 Comment

Accepted Solution

Haddion earned 750 total points
ID: 20054912
You can use the Confirm parameter to suppress prompts:

Import-Csv recipients.csv | foreach {Remove-Mailbox -Confirm:$False -identity $_.Identity

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

830 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