You may need to use the -domaincontroller param to avoid issues with AD
replication, if you use both new-mailcontact & set-user in the same
script.  That caught me out a few times.

T
On 18 Jun 2013 01:00, "phil levine" <[email protected]> wrote:

> Thanks. I will try it tomorrow. As always I appreciate the help and your
> knowledge.
>
>
>   ------------------------------
>  *From:* Michael B. Smith <[email protected]>
> *To:* "[email protected]" <[email protected]>
> *Sent:* Monday, June 17, 2013 7:42 PM
> *Subject:* RE: [Exchange] CSV Import for creating Contacts
>
>  Well, duh.
>
> Set-User is the cmdlet to use.
>
>  *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Michael B. Smith
> *Sent:* Monday, June 17, 2013 7:15 PM
> *To:* [email protected]
> *Subject:* RE: [Exchange] CSV Import for creating Contacts
>
> That is a really good question.
>
> And I don’t know the answer.
>
> AFAIK, you have to use ADSI to set the various telephone numbers.
>
>  *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *phil levine
> *Sent:* Monday, June 17, 2013 6:06 PM
> *To:* [email protected]
> *Subject:* Re: [Exchange] CSV Import for creating Contacts
>
>  Thanks as usual Michael. What about if they want to add Business Phone?
>
>
>    ------------------------------
>  *From:* Michael B. Smith <[email protected]>
> *To:* "[email protected]" <[email protected]>
> *Sent:* Monday, June 17, 2013 5:56 PM
> *Subject:* RE: [Exchange] CSV Import for creating Contacts
>
>   I generally do something like this. You’ll need to adjust it for local
> norms:
>
>                  $alias = $params.emailperm.SubString( 0,
> $params.emailperm.IndexOf( '@' ) )
>
>                  $displayName = ''
>                  if( $params.ContainsKey( 'first_name' ) )
>                  {
>                                  $displayName += $params.first_name
>                                  $mbparams.FirstName = $params.first_name
>                  }
>
>                  if( $params.ContainsKey( 'middle_name' ) )
>                  {
>                                  if( $displayName.Length -gt 0 )
>                                  {
>                                                  $displayName += ' '
>                                  }
>                                  $displayName += $params.middle_name
>                                  $mbparams.Initials = $params.middle_name
>                  }
>
>                  if( $params.ContainsKey( 'last_name' ) )
>                  {
>                                  if( $displayName.Length -gt 0 )
>                                  {
>                                                  $displayName += ' '
>                                  }
>                                  $displayName += $params.last_name
>                                  $mbparams.LastName = $params.last_name
>                  }
>
>                  if( $displayName -eq '' )
>                  {
>                                  $displayName = $alias
>                  }
>
>   *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *phil levine
> *Sent:* Monday, June 17, 2013 5:50 PM
> *To:* [email protected]
> *Subject:* [Exchange] CSV Import for creating Contacts
>
>   I'm trying to import a bunch of contacts and I want to populate
> DisplayName by combining FirstName and LastName, is this possible? How
> would I do this? I would also like to take FirstName and Lastname in the
> CSV and use it for the Name parameter to make it the alias, ie. Jim.Little.
>
>   Any help would be great. I always appreciate it.
>
>   Thanks
>
>   Phil
>
>    Here's an example of what I have to work with. The script works when I
> manually populate the Name and DisplayName fields.
>
> Import-CSV C:\employees-pl.csv | ForEach-Object{New-MailContact
> -ExternalEmailAddress $_.Emailaddress -DisplayName $_.DisplayName -Name
> $_.Name -FirstName $_.FirstName -LastName $_.LastName -OrganizationalUnit
> $_.OUpath}
>
>    FirstName
>   LastName
>   Emailaddress
>   Name
>   DisplayName
>   OUPath
>    Anna
>   Little
>   [email protected]
>    ad.domain.com/domain/domain contacts
>
>
>
>
>

Reply via email to