Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Exchange Powershell one-liner to Mail-Enable Contacts

Reply
 
Old 09-22-2008   #1 (permalink)
RobDG


 
 

Exchange Powershell one-liner to Mail-Enable Contacts

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.contact@xxxxxx" 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?

My System SpecsSystem Spec
Old 09-23-2008   #2 (permalink)
Shay Levy [MVP]


 
 

Re: Exchange Powershell one-liner to Mail-Enable Contacts

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.contact@xxxxxx" 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>


My System SpecsSystem Spec
Old 09-23-2008   #3 (permalink)
RobDG


 
 

Re: Exchange Powershell one-liner to Mail-Enable Contacts

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]" wrote:
Quote:

> 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.contact@xxxxxx" 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>
>
>
>
My System SpecsSystem Spec
Old 09-23-2008   #4 (permalink)
Shay Levy [MVP]


 
 

Re: Exchange Powershell one-liner to Mail-Enable Contacts

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>
Quote:
Quote:

>> 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.contact@xxxxxx" 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>

My System SpecsSystem Spec
Old 09-23-2008   #5 (permalink)
RobDG


 
 

Re: Exchange Powershell one-liner to Mail-Enable Contacts

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!


"Shay Levy [MVP]" wrote:
Quote:

> 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>
Quote:
Quote:

> >> 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.contact@xxxxxx" 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>
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
bulk mail enable contacts for existing AD users PowerShell
one-liner PowerShell PowerShell
Synch Exchange Server and Vista Mail & Contacts Vista mail
Using Exchange Server account for mail, calendar and contacts Vista mail
Exchange 2007 "Activate the PowerShell" One liner Contest PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46