When you say "add contacts into the server", what exactly do you mean?
Exchange doesn't contain contacts itself. You can add contacts to active directory to be visible in the global address book for all exchange users. There's sample code to do this here.
Alternatively you can add contacts to an individual user's contacts in outlook, which will make them available to that individual user - you can of course run this script for several users if you want to make the contacts available to more than one person. Not tested this one, but there's sample code available here to get you started.
If you go with the first route and have a large number of contacts to add then you may end up with a Global Address List (GAL) that is very large and difficult to use, and the unpleasant prospect of emails intended for internal use only sent to external people who are in your contacts list. It's possible to prevent this by creating more than one view of the GAL - one that includes contacts and one that only includes Windows accounts (aka 'full' exchange users).
You can use the Exchange Management Shell to manipulate the GAL as follows (example from technet forums)
Get-GlobalAddressList "Default Global Address List" |FL *Filter
As I work at a college, we've played about with examples similar to the above ones to control what students can and cannot see in the GAL, so I know the principles work, you'll just need to fiddle and test the filters until you get a result you're happy with. We're using Exchange 2007 but for things like this there shouldn't be any significant differences.
When you say "add contacts into the server", what exactly do you mean?
Exchange doesn't contain contacts itself. You can add contacts to active directory to be visible in the global address book for all exchange users. There's sample code to do this here.
Alternatively you can add contacts to an individual user's contacts in outlook, which will make them available to that individual user - you can of course run this script for several users if you want to make the contacts available to more than one person. Not tested this one, but there's sample code available here to get you started.
If you go with the first route and have a large number of contacts to add then you may end up with a Global Address List (GAL) that is very large and difficult to use, and the unpleasant prospect of emails intended for internal use only sent to external people who are in your contacts list. It's possible to prevent this by creating more than one view of the GAL - one that includes contacts and one that only includes Windows accounts (aka 'full' exchange users).
You can use the Exchange Management Shell to manipulate the GAL as follows (example from technet forums)
you will see a filter like:
I've highlighted where the default GAL's filter includes contact objects too, because of the condition ObjectClass -eq 'contact'.
So if you want that your default GAL exclude these contacts object then you will have to reset the Recipient Filter of your GAL like this:
and then you can create some other GAL for the contacts similar to this:
As I work at a college, we've played about with examples similar to the above ones to control what students can and cannot see in the GAL, so I know the principles work, you'll just need to fiddle and test the filters until you get a result you're happy with. We're using Exchange 2007 but for things like this there shouldn't be any significant differences.