Windows PowerShell


PowerShell Script - Exchange 2007 Mailcontact

PowerShell Script - Exchange 2007 Mailcontact Create new MailContact with Exchange 2007 System Manger

This page explains how to create Contact and  - Mailcontact objects in Exchange 2007.  If you are looking for a straightforward example to learn Exchange 2007 PowerShell commands, then Mailcontact is an ideal vehicle to practise.  The key verbs are: get, new and disable.

Topics for Mailcontact

 ♣

Walk-through with Exchange Management Console

To begin with, I recommend a walk-through with the Exchange Management Console.  Firstly it will clarify the objects that we are creating, secondly it will alert you to nuances such as Aliases don't have spaces.

Get-Mailcontact

As a prelude, open the PowerShell command prompt and type:

get-mailcontact (Only Mail enabled objects)
get-contact (Includes disabled contacts)

Type these commands after you have created a new mail object with the GUI, and again after you employ PowerShell to create the Mail Contact.

Note: As with so many PowerShell nouns contact is both case insensitive and singular.

New-Mailcontact

Our mission is to achieve with PowerShell what you could do manually with the Wizard (See Right).  Once you issue the plain command New-Mailcontact, you need to provide information about:

ExternalEmailAddress:Create New Mail Contact Wizard
Name:
Alias:
OrganizationalUnit:

Example 1 Create a New Mailcontact called Eddie Jones"

New-Mailcontact
ExternalEmailAddress: ernie@guy-sports.com
Name: Ernie Prost
Alias: ErnieProst
OrganizationalUnit: Droitwich

Once created you should see your new Mailcontact.  Try viewing all such objects try:

get-mailcontact | ft -autosize name, alias, ExternalEmailAddress.

Note: ft is an alias or shorthand for format-Table.

Disable-Mailcontact

Disabling is different from deleting the object.  Disabled Mail Contacts appear in the Exchange System Manager and can be verified by comparing Get-Mailcontact with Get-Contacts.  You can also confirm by checking the contents of the Disconnected folder in the Exchange Management Console.

Example 2 Disable a Mailcontact

Disable_Mailcontact 'Eddie Jones'

Note: For names with spaces, enclose them with single quotes.

Test your command with Get-Contact.  Compare the results with Get-Mailcontact.  See Exchange Nouns also see Exchange PowerShell Verbs

Guy Recommends: SolarWinds LANSurveyorSolarwinds LANSurveyor

LANSurveyor will produce a neat diagram of your network topology.  But that's just the start; LANSurveyor can create an inventory of the hardware and software of your machines and network devices.  Other neat features include dynamic update for when you add new devices to your network.  I also love the ability to export the diagrams to Microsoft Visio.

Finally, Guy bets that if you take a free trial of LANSurveyor then you will find a device on your network that you had forgotten about, or someone else installed without you realizing!

Download a Free Trial of LANSurveyor

Summary of Mailcontact

Mailcontact is an Exchange 2007 object and PowerShell noun.  In order to control Mailcontact, master the verbs get, new and disable.

See more Microsoft PowerShell tutorials

Windows PowerShell Home  • Introduction  • Cmdlets  • Exchange 2007  • Profile.ps1  • $_.Pipeline

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links, I will be happy to not only to correct the fault, but also to give you credit.

 *


Google

Web  This website

Review of Orion NPMGuy Recommends: Orion's NPM - Network Performance Monitor

Orion's performance monitor is designed for detecting network outages. A network-centric view make it easy to see what's working, and what needs your attention.

This utility guides you through troubleshooting by indicating whether the root cause is faulty equipment or resource overload.

Download a free trial of the Network Performance Monitor

 

Home Copyright © 1999-2009 Computer Performance LTD All rights reserved

Please report a broken link, or an error.