Checking if a mailbox is valid using Exchange Management Shell

Share this:

In some scenarios we need to check if a mailbox database is valid on Exchange Server, this kind of validation is useful when migrating/transitioning mailboxes.

Solution


In order to validate mailboxes we can use an if clause to validate if the mailbox exists or not in the environment, and based on that we provide a brief description. The following cmdlet can be used.

$users = Import-csv File.csv

$users| foreach { if (-not (Get-mailbox $_.Alias -ErrorAction silentlycontinue)) {write-host $_.Alias ” does not exist! Please correct it! “} else {write-host $_.Alias ” exists”} }

 

image

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

Managing Hyper-V Server remotely through PowerShel... Working with PowerShell can be very common for daily tasks and Hyper-V Server management. However, as there is more than one server to be managed, som...
How to generate SMTP Address reports in your Excha... In this Tutorial we are going over two simple methods to create reports to list SMTP address. The first section will cover how to list all primary SMT...
Performing daily task with PowerShell to manage Hy... As a virtualization administrator, you will come across a lot of scenarios where you will need to create, modify, move, export, and other tasks to man...
Performing Backup on your DHCP Server In this Tutorial we will be checking the process to protect the DHCP Server database using the automatic configuration, Graphical User Interface and P...