Bulk Disable Mailboxes in Exchange 2010

In a recent post, I wrote about performing a bulk export of mailboxes from a collection (https://deangrant.wordpress.com/2013/10/08/bulk-export-of-exchange-mailboxes-from-a-collection/), now that I have performed the bulk export I am looking to disable to the mailboxes using the same collection list.

I will load the collection of mailboxes from a CSV file using the get-content cmdlet to get the content of the file (\\Server\Share\Mailboxes.csv) which contains the alias name of the mailbox.

$Mailboxes = Get-Content "\\Server\Share\Mailboxes.csv"

Now that we have loaded a collection of mailboxes, we will run a script block to disable each mailbox.

ForEach ($Mailbox in $Mailboxes)
{ 
Disable-Mailbox -Identity $Mailbox -Confirm:$false
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s