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 }