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.
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.