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

Running PowerShell on Mac OS PowerShell for everyone! In this Tutorial we are going the installation process on Mac OS.SolutionThe first step is to download the .pkg file which is...
How to install Microsoft Azure PowerShell In this Tutorial we are going over the process to install Microsoft Azure PowerShell and we can use the same procedure to update several other compone...
How to rename an AWS EC2 instance during provision... In the Cloud era the VM/instance name is not that important, especially when we have a fleet of servers doing the same work, and that is key for scena...
Managing features at Network Adapter level using P... Using PowerShell to manage features at network adapter level, the tasks that we are going over on this Tutorial may be required when managing a larger...