Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exchange Powershell one-liner to Mail-Enable Contacts

175 views
Skip to first unread message

RobDG

unread,
Sep 22, 2008, 10:13:00 PM9/22/08
to
Hello - I am trying to use powershell to mail-enabled several hundred AD
contacts objects. I am testing on one contact object with the following
one-liner:

get-contact -identity "domain.com/Users/Test Contact" | foreach {
enable-mailcontact -ExternalEmailAddress $_.WindowsEmailAddress }

The WindowsEmailAddress attribute has a valid SMTP address but the command
fails with the following message:

Enable-MailContact : Cannot bind parameter 'ExternalEmailAddress'. Cannot
convert "test.c...@domain.com" to "Microsoft.Exchange.Data.ProxyAddress".

There isn't much information on Microsoft.Exchange.Data.ProxyAddress other
than it is looking for a SMTP address which I believe I have supplied it.

Anyone here have any ideas on the error or another approach?

Shay Levy [MVP]

unread,
Sep 23, 2008, 8:19:34 AM9/23/08
to
Hi RobDG,

Correct me If I'm wrong, if the contact has an WindowsEmailAddress value
then isn't it already enabled?

---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar

R> Hello - I am trying to use powershell to mail-enabled several hundred
R> AD contacts objects. I am testing on one contact object with the
R> following one-liner:
R>
R> get-contact -identity "domain.com/Users/Test Contact" | foreach {
R> enable-mailcontact -ExternalEmailAddress $_.WindowsEmailAddress }
R>
R> The WindowsEmailAddress attribute has a valid SMTP address but the
R> command fails with the following message:
R>
R> Enable-MailContact : Cannot bind parameter 'ExternalEmailAddress'.
R> Cannot convert "test.c...@domain.com" to
R> "Microsoft.Exchange.Data.ProxyAddress".
R>
R> There isn't much information on Microsoft.Exchange.Data.ProxyAddress
R> other than it is looking for a SMTP address which I believe I have
R> supplied it.
R>
R> Anyone here have any ideas on the error or another approach?
R>


RobDG

unread,
Sep 23, 2008, 10:51:01 AM9/23/08
to
Hi Shay - Unfortunately no. There are several Exchange attributes that need
to get populated besides the e-mail address. This seems like it should be a
very straightforward powershell command sequence..

Shay Levy [MVP]

unread,
Sep 23, 2008, 3:21:29 PM9/23/08
to
Hi RobDG,


What do you get for:

PS > Get-Contact 'Test Contact' | Disable-MailContact

Is it similar to this error:

PS > Disable-MailContact : "domain.com/Users/Test Contact" is not a mail
contact.

If so, does this work:

Get-Contact 'Test Contact' | foreach {
Enable-MailContact $_ -externalEmailAddress $_.windowsEmailAddress.toString()
}

---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar

R> Hi Shay - Unfortunately no. There are several Exchange attributes
R> that need to get populated besides the e-mail address. This seems
R> like it should be a very straightforward powershell command
R> sequence..
R>
R> "Shay Levy [MVP]" wrote:
R>

RobDG

unread,
Sep 23, 2008, 5:45:01 PM9/23/08
to
That is great Shay! I remember playing with the $_ to pass the identity but
I didn't know about the .toString() option. Thanks much for the help!
0 new messages