?
Solved

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

Posted on 2009-02-24
16
Medium Priority
?
692 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:dubwhizz
  • 8
  • 8
16 Comments
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722013

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
 

Author Comment

by:dubwhizz
ID: 23722039
got a link for me to read on that?

Matt
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722135

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

Chris
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:dubwhizz
ID: 23722320
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
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722369

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
 

Author Comment

by:dubwhizz
ID: 23722448
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
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722532

> 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
 

Author Comment

by:dubwhizz
ID: 23722659
>>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
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722711

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
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722723

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

e.g.

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

Chris
0
 

Author Comment

by:dubwhizz
ID: 23722762
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
 

Author Comment

by:dubwhizz
ID: 23722837
this is the csv im trying with now
output.csv.txt
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23722919

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
 

Author Comment

by:dubwhizz
ID: 23723029
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
 
LVL 71

Expert Comment

by:Chris Dent
ID: 23723031

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
 

Accepted Solution

by:
dubwhizz earned 0 total points
ID: 23732176
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

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question