views:

79

answers:

1

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?

A: 

Ok I have tried all the permutations I can think of for this string and they all fail -

-Org "pub_contacts"
-Org "/pub_contacts"
-Org "/Public Folders/pub_contacts"
-Org "/Default Public Folders/pub_contacts"
-Org "sbs2008.domain.local/pub_contacts"
-Org "sbs2008.domain.local/Public Folders/pub_contacts"
-Org "sbs2008.domain.local/Default Public Folders/pub_contacts"

I have seen the syntax for -Org "ou= dc= cn=" used in some examples of my exhaustive search for an answer to how to reference a public folder through the required syntax for this command.

>> Get-publicfolder -GetChildren
Name                                                        Parent Path                                                
----                                                        -----------                                                
pub_contacts                                                \                                                          

This information does not seem to help either.

Any more ideas?

Heals1ic