Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Contacts from CSV

Status
Not open for further replies.

burden010

Technical User
Feb 8, 2005
21
GB
Hi,

I'm trying to import roughly 150,000 contacts from CSV into an OU as mail enabled users. To do this I'm using the following script:

# Create New OU
$AD = [adsi]"LDAP://dc=domain,dc=local"
$ou = $AD.Create("OrganizationalUnit", "ou=Contacts")
$ou.SetInfo()

# Import Contacts from CSV
$OU = "Contacts"
Import-CSV -Path "c:\GAL\allmailboxes.csv" | %{
New-MailContact $_."displayName" -DisplayName $_."displayName" `
-FirstName $_."givenName" -LastName $_."sn" `
-organizationalunit $OU -Alias $($_."mailNickname" -Replace " ") `
-ExternalEmailAddress $_."mail"
} > c:\gal\importlog.log


Anyway, the problem I have is that only imported contacts show in the importlog.log there are no errors, which seem to only show in the Exchange Management Shell. I need to log the errors above anything else. Is there a command I can use to export ALL output to the file?

BTw, I have also tried using Out-File but this has the same effect.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top