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

Posted on 2007-10-08
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
    LVL 5

    Accepted Solution

    You can use the Confirm parameter to suppress prompts:

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

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
    Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
    In this video we show how to create a User Mailbox 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 >> Mailb…
    This video discusses moving either the default database or any database to a new volume.

    754 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

    22 Experts available now in Live!

    Get 1:1 Help Now