Powershell Check to see if mailbox exists

Scenario:  You have a list of mailboxes that you do not know if they still exist or not.  Instead of checking one by one, you can script this.  

In my users.csv I have a header with Name that contains all of the aliases underneath.


$users = Import-csv C:users.csv
$users | ForEach { $exist = [bool](Get-mailbox $_.name -erroraction SilentlyContinue); Write-host “$Exist $_.Name”}

Advertisement

One thought on “Powershell Check to see if mailbox exists”

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 )

Connecting to %s

%d bloggers like this: