Bulk Remove-MailContact option in Exchange 2007
I have approximately 8000 mail contacts that I need to refresh with a new list from our parent company. I would like to remove all the current ones in case people have quit and the mailboxes no longer exist. I distinguish these contacts by using the company field. Is there any way to remove all mail contacts where company equals "theComapnyName"?<o:p></o:p> I tried using the command "Remove-MailContact -Company companyName" with no luck.<o:p></o:p> Thanks
October 26th, 2012 11:45am

If you choose the correct syntax, you should be able to pipe the results of Get-MailContact into Remove-MailContact . Something like Get-MailContact -Anr "thecompanyname" | RemoveMailcontact but try a whatif first: Get-MailContact -Anr "thecompanyname" | RemoveMailcontact -whatif or just Get-MailContact to see first which ones would be affected Get-MailContact -Anr "thecompanyname" Mobile OWA For Smartphone www.leederbyshire.com email a@t leederbyshire d.0.t c.0.m
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2012 1:14pm

Oops - you said the Company field. So that won't work. Will try again later, but have to go now.Mobile OWA For Smartphone www.leederbyshire.com email a@t leederbyshire d.0.t c.0.m
October 26th, 2012 1:15pm

Thanks. I will keep an eye out for replies!Gary Barber
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2012 1:25pm

Okay, try Get-Contact -Filter {Company -eq "thecompanyname"} if you are satisfied that it only returns the required contacts, try Get-Contact -Filter {Company -eq "thecompanyname"} | Remove-MailContactMobile OWA For Smartphone www.leederbyshire.com email a@t leederbyshire d.0.t c.0.m
October 26th, 2012 2:08pm

Thank you very much! For anyone interested, the full command I ended up running was: Get-Contact -Filter {Company -eq "thecompanyname"} -ResultSize 10000 | Remove-MailContact -confirm:$false The -confirm:$false keeps from being prompted to remove every user. Gary Barber
Free Windows Admin Tool Kit Click here and download it now
October 26th, 2012 2:42pm

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

Other recent topics Other recent topics