Используя Powershell для Создания Контактов Exchange из.CSV файла

Выполните что-то вроде этого на сервере базы данных для разрешения входящих соединений:

/sbin/iptables -I INPUT 1 -p tcp -d ${ip_of_db_server} --dport ${port} -j ACCEPT

Для наблюдения текущих правил в действительности работайте:

/sbin/iptables -L -v

См. https://help.ubuntu.com/community/IptablesHowTo для основного введения.

0
задан 28 August 2013 в 22:30
1 ответ

EDIT: grr...I forgot Exchange 2003...the below only works on Exchange 2007 and above.

For Exchange 2003 you need to use csvde: http://support.microsoft.com/kb/327620

An example of how to format the csv file and the csvde command can be found here: http://forums.msexchange.org/m_1800509533/printable.htm

QUOTE:

objectClass,DN,displayName,proxyAddresses,targetAddress,mail,mailNickname,givenName,sn,showInAddressBook

objectClass = Class of the object which you are creating (In your case "contact") DN = Distinguish Name of the object displayName = Display Name of the object proxyAddresses = type:proxy address of the contact object (for example SMTP:user@domain.com) targetAddress = type:target адрес контактного объекта (например SMTP: user@domain.com ) mail = Почта (которую вы можете увидеть в общей вкладке контактного объекта) mailNickname = псевдоним имя контактного объекта givenName = Имя sn = Last Name showInAddressBook = для включения контакта в глобальном списке адресов (даже если мы не указали это значение, контакт будет отображаться в GAL по умолчанию)

Если хотите, я пришлю вам образец CSV-файла.

Возможно, вам придется изучить советы и рекомендации по Excel, чтобы создать CSV-файл. из входных данных.

После создания файла CSV вы можете использовать следующую команду для import the contact objects.

CSVDE -i -f For Ex : CSVDE -i -f c:\test.csv

-i = for specifying import mode

-f = For specifying the input file

Another alternative is a 3rd party utility like AD Bulk Contacts: http://www.dovestones.com/active-directory-contact-import/


OK, here's what I would do (if this were Exchange 2007+ lol)

Setup of csv file

First, open your CSV file in Excel. You need to make your CSV file better for input into PS "script".

  1. Change Name to DisplayName
  2. Copy this DisplayName Column to a new column calledTempName`
  3. Change Email to prefix
  4. Create a new column called FirstName
  5. Create a new column called LastName
  6. Create a new column called Email

Getting FirstName and LastName column populated:

  1. Highlight all of the data in TempName and choose Data then Text to Columns and split out based on a space the first and last names

  2. Now copy the first and last names into their respective new columns you created in #4-5.

Getting Email column populated:

  1. In the email column go to the empty cell adjacent to the the first row of data. ie, there should be the 9426645555 in the prefix column on the same row to the left somewhere, let's say that data is in B3 for example. Here you'll create a formula to concatenate the email prefix with the domain. Something like =CONCATENATE(A2,"@domain.com") then copy and paste that down the column to get all the email addresses correct.

Now at this point you should have rows that have a DisplayName, FirstName, LastName, and Email that has valid info for a single user. Don't worry about the extraneous columns...we won't use them in the input.

Save the file now as a CSV file and then verify the CSV file looks accurate for input

On to the Powershell script:

$csv = Import-Csv C:\Contacts.csv 
foreach($line in $csv) 
{ 
New-MailContact -Name $line.DisplayName -FirstName $line.FirstName -LastName $line.LastName -ExternalEmailAddress $line.Email -OrganizationalUnit Contacts -Alias $line.Alias
} 

That should at least point you in the direction to get you there. If you get stuck, let me know.

2
ответ дан 4 December 2019 в 14:07

Теги

Похожие вопросы