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

Using PowerShell as default option in Windows 10 m... By default in Windows 10 (well, on previous versions as well) when we either use right-click on the lower-left corner or Windows + X , we will have a ...
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...
Using Azure Resource Manager in PowerShell How to connect to Microsoft Azure PowerShell and use Azure Resource Manager deployment mode. Solution Microsoft Azure is a dynamic environment...
Script to create a VPN Site-to-Site using Azure Re... The process to create a VPN Site-to-Site in Microsoft Azure requires a series of cmdlets, and at this time the administrator cannot use Azure Preview ...