I am trying to import a CSV file containing many contacts to a public folder in exchange 2007 installed on SBS2008 for use by outlook users.
I have this script that I am trying to run through powershell 1.0 (there seems to be no powershell 2.0 installable for SBS2008).
I have created a folder in the Public Folder area called pub_contacts and allocated it to contain contact items.
The script:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
Add-Content debug.txt "::Starting Import: ";
$err = "";
Import-Csv test.csv | ForEach-Object{
New-MailContact -DomainController sbs2008.domain.local -Name $_."displayName" -Firstname $_."firstName" -Lastname $_."lastName" -ExternalEmailAddress $_."Email" -OrganizationalUnit "ou=pub_contacts" -ErrorAction SilentlyContinue -ErrorVariable +err | Set-Contact -DomainController dc.domain.local -City $_."busCity" -Company $_."Company" -Office $_."Office" -DisplayName $_."displayName" -Fax $_."businessFax" -Name $_."displayName" -Phone $_."businessPhone" -PostalCode $_."busPostalCode" -State $_."busState" -StreetAddress $_."busStreet" -Title $_."Title" -ErrorAction SilentlyContinue -ErrorVariable +err;
Set-MailContact -Identity $_."displayName" -DomainController sbs2008.domain.local -ErrorAction SilentlyContinue -ErrorVariable +err;
}
Add-Content debug.txt $err;
I keep getting the exception –
Organizational unit "ou=pub_contacts" was not found
How do I find the OU for pub_contacts in the Public Folders in exchange?
Or is there a better way to access a central contacts list (of external contacts) for all users in the organisation?