header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

Problem with Array
Last Post 11 Jan 2010 06:05 PM by Ayth. 0 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
AythUser is Offline
Basic Member
Basic Member
Posts:171
Avatar

--
11 Jan 2010 06:05 PM  
Hello,

I know I've ran into this before, but cannot remember how I worked around it. I have a CSV that has a list of contact records in it. Like so:

name
"deGraft-Johnson, AnneMarie"
"Ming, Adwina"
"tyers, greg"
"Oakley, Heather"
"Alexander, Blake"

I'm trying to loop through them and get each contact record, then I'll add it to a distribution group. But I'm getting the following error:

Get-MailContact : Cannot bind parameter 'Identity'. Cannot convert the "@{email
 =omahony, elizabeth}" value of type "System.Management.Automation.PSCustomObje
ct" to type "Microsoft.Exchange.Configuration.Tasks.MailContactIdParameter".
At C:\test.ps1:5 char:26
+ Get-MailContact -identity <<<<  $($email) -resultsize unlimited
    + CategoryInfo          : InvalidArgument: (:) [Get-MailContact], Paramete
   rBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang
   e.Management.RecipientTasks.GetMailContact

From what I can see it's casting the variable into the wrong type, and it's not getting the contact. Can anyone assist? Thanks.
My Blog about Powershell http://poweroftheshell.blogspot.com/ Follow me on twitter @darrinhenshaw
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer