cannot email a script created contact when using powergui or csvde to import

I've been using csvde and powergui to create contacts. The contacts are in a csvde created csv file. the contactsare of all users in our parent company. we have for legal reasons a totally separate AD and Exchange org. we need to email their users.

They have managed to import our csv file and can email us

so, we've got the csv file with objectClass, mailNickName, displayNAme, targetAddress,mail, proxyAddresses, DN, sn, givenName and msexchangePoliciesIncluded in to set the actual contacts up.
This works ok. the contacts are created. 30 seconds later RUS gives them an x400 address which I'm led to believe they need.
So if i try to email the user at this point it doesn't work. I don't get the NDR message as if it were failing at the SMTP server, its much earlier.

we are trying to route to the users across our VPN. so we've got an address space set up with an address that could be internal only (ends in .global) and the connector is specified for the receiving bridgehead by ip address.

if i were to creat the contact manually (right click, new contact in AD U&C) then it works perfectly. but the scripted users always fail. does anyone have any ideas why?
Import-csv c:\scripts\galimport\output.csv | Foreach { New-QADObject -type contact -ParentContainer icec.local/GroupContacts -name $_.Name -displayname $_.displayName  | Set-QADObject -oa @{ givenName=$_.givenName; sn=$_.sn; mailNickName=$_.mailNickName; proxyAddresses=$_.proxyAddresses;} }

Open in new window

dubwhizzAsked:
Who is Participating?
 
dubwhizzAuthor Commented:
It always populated the targetAddress  field.

however this morning I've realised that the targetAddress field needs the SMTP: prefix, which the script is missing. once you force this in, it works.

Matt
0
 
Chris DentPowerShell DeveloperCommented:

I take it this is Exchange 2003? It makes a bit of a mess of the contact at the moment.

I advise you use the MailEnable method of CDOEXM to mail enable contacts for Exchange 2003. If this is Exchange 2007 then there are far better cmdlets to use.

Chris
0
 
dubwhizzAuthor Commented:
got a link for me to read on that?

Matt
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
Chris DentPowerShell DeveloperCommented:

It's a bit of a bugger to call from PowerShell, much easier from VbScript. Are you intent on sticking with PowerShell?

Chris
0
 
dubwhizzAuthor Commented:
ive already tried from vbs, with the contents of the csv file. creates users fine but you cant email them.

found this so trying to get it to work.
http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_24054981.html

Matt
0
 
Chris DentPowerShell DeveloperCommented:

I have one to explicitly import from CSV rather than the version in the post which imports from Excel:

http://www.highorbit.co.uk/?p=377

I'd change your import file to only contain these though:

mailNickName,displayName,targetAddress,mail,sn,givenName

Or if that's no go I can always write another simpler one.

Chris
0
 
dubwhizzAuthor Commented:
i dont actually think its the import of the contact that is the problem. i think the routing of the email doesnt understand that the particular contact should use a certain connector and its failing there.

the one I've highlighted above is borked, so i'll try yours. but its not the creation of the contacts, iuts the inability to email them once created.

if i could just create 1200 contacts by hand, there wouldnt be this issue. but im too "laxy" apparantly.

Matt
0
 
Chris DentPowerShell DeveloperCommented:

> i dont actually think its the import of the contact that is the problem

I do, I've seen the contact it creates and it's not pretty ;)

To start with there's no TargetAddress attribute (which is required), and the no type identifier for the address added to ProxyAddresses (should be SMTP:<mailaddress>, not just <mailaddress>).

The easiest way to fix that is to use VbScript and call MailEnable on the contact which fills in all the blanks (proxyAddresses, targetAddress, et al). It's only a shame it's such a hassle to call CDOEXM from PowerShell.

> but im too "laxy" apparantly.

I would disagree with that :)

The reason the script on my blog exists is because I was fed up with re-writing what amounted to the same script again and again to cope with a task exactly like yours.

I don't think creating them manually / by hand even crossed my mind.

Chris
0
 
dubwhizzAuthor Commented:
>>To start with there's no TargetAddress attribute (which is required), and the no type identifier for the address added to ProxyAddresses (should be SMTP:<mailaddress>, not just <mailaddress>).

I've managed to correctly assign both of those attributes and it still doesnt work.

cant get your script to work and it wont tell me why :(
0
 
Chris DentPowerShell DeveloperCommented:

Do you have the Exchange System Tools installed where you're running the script from?

Not to worry if it doesn't work, we can just write a new one.

Chris
0
 
Chris DentPowerShell DeveloperCommented:

Oh, and is the input in the CSV file quoted values?

e.g.

"contact","nickname", ....

Chris
0
 
dubwhizzAuthor Commented:
chris,

i do have ESM on my box.

in the CSV i've got quotes around fields that have the comma character in them. I've also got the DN field in there and populated too.

Matt
0
 
dubwhizzAuthor Commented:
this is the csv im trying with now
output.csv.txt
0
 
Chris DentPowerShell DeveloperCommented:

The mix of quoted and unquoted values will hopelessly confuse my VbScript that's for sure.

Maybe we'd be better off with Excel after all. Can you save it as that and I'll rewrite the script from the other thread for this.

Chris
0
 
dubwhizzAuthor Commented:
Chris,

I've already got the script from the other thread working, it imports users fine. you still can't email them though. No need to rewrite it.

managed to add the above comment to the wrong thread too.

Matt
0
 
Chris DentPowerShell DeveloperCommented:

Does it populate the TargetAddress now (under the Exchange General tab)?

Does it list e-mail addresses when you view it in the Address Book through Outlook?

Chris
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.