using a csv file with remove-mailbox cmdlet
is there a way to use a csv with the remove-mailbox cmdlet ? i have a list of 120 mailboxes or so in a csv file that i want to delete. thanks in advance.
September 22nd, 2010 2:11pm

Import-Csv users.csv | foreach {Remove-Mailbox -Confirm:$False -identity $_.Identity} import-csv http://technet.microsoft.com/en-us/library/ee176874.aspx http://technet.microsoft.com/en-us/library/dd347665.aspx
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2010 2:24pm

ok thanks then if i want to add the permanent arugemnt it would look like Import-Csv users.csv | foreach {Remove-Mailbox -Confirm:$False -identity $_.Identity -Permanent $true} is that right ?
September 22nd, 2010 2:29pm

Yes. Though permanent is just that.
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2010 2:41pm

gotcha . where does the csv have to reside. i am getting an error : Remove-Mailbox : Cannot bind argument to parameter 'Identity' because it is null. At line:1 char:80
September 22nd, 2010 2:42pm

Do you the identity column defined correctly in the csv. That first article has examples
Free Windows Admin Tool Kit Click here and download it now
September 22nd, 2010 2:45pm

gotcha letme take a look at that first article real quick and give it another go . i appreciate the insight .
September 22nd, 2010 2:49pm

Hi Charz1121, The error you got indicates the command cannot retry the data of .csv file. Because the .csv file does not include the column which is named Identity. Please perform the following steps: 1. Create the .csv file which is named users in c:\. 2. Fill the names of you want to remove in the column which is named Name. 3. Open the Exchange Management Shell, and then input command: Import-Csv c:\users.csv | Foreach {Remove-Mailbox –Confirm: $false –Identity $_.Name –Permanent $true} They will be removed after you perform the steps above. For more information, you can refer the documents provided by Andy. Best regards, Serena
Free Windows Admin Tool Kit Click here and download it now
September 23rd, 2010 9:56pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics